Obsidian Asciimath
Install
- (Recommended) Goto Obsidian plugin market, search for
obsidian-asciimath
and install it. - (Manually) Goto the release page, download the zip, unzip it and add it to your plugins folder.
Usage
You can write math formulas with the syntax of asciimath.
Code block
```am (or asciimath)
sum _(n=1) ^oo 1/n^2 = pi^2/6
```
Multiline formula alignment (Specially thanks to asciimath-js)
```am
f: RR & -> S^1
<-- a blank line here
x & |-> "e"^(2pi "i" x)
```
asciimath is simple and easy to read, while in LaTeX, you should write the long formula with so many backslashes, and sometimes may be confusing...
\begin{aligned} f: \mathbb{R} & \to S^{1} \\ x & \mapsto \mathrm{e}^{2 \pi \mathrm{i} x } \end{aligned}
Inline asciimath
By default, the inline formula should be wrapped with `$ and $`, that is, you should input the formula like
The integral `$int _0^(+oo) "e"^-x dx = 1$`.
For more infomation about asciimath, please refer to asciimath.org and zmx0142857's note (in Chinese).
Configuration
You can add other prefix alias of code block in the settings. The default values are asciimath
and am
.
Inline formula can only be wrapped with special escapes. Just look at the examples below.
- start: `` !!! invalid !!!
- end: `` !!! invalid !!!
- start: ` !!! invalid !!!
- end: ` !!! invalid !!!
+ start: `$ √√√ valid √√√ // default
+ end: $` √√√ valid √√√ // default
+ start: `$$ √√√ valid √√√
+ end: $$` √√√ valid √√√
+ start: `* √√√ valid √√√
+ end: *` √√√ valid √√√
+ start: `{ √√√ valid √√√
+ end: }` √√√ valid √√√
+ start: `[ √√√ valid √√√
+ end: ]` √√√ valid √√√
(... any other valid escapes ...)
After changing the settings, DON'T FORGET to hit the "Save" button.
Commands
- Insert asciimath codeblock
- Convert asciimath into mathjax in current file
Development
git clone git@github.com:widcardw/obsidian-asciimath.git
pnpm i
pnpm run dev