markdown-it-asciimath
v1.0.0
Published
Markdown-it plugin to include ascii-math
Downloads
3,822
Maintainers
Readme
markdown-it-asciimath
Markdown-it plugin to include ascii-math.
Code block
Example input:
```math
1+1=2
varphi = int_0^10 x^2 dx
```
Output: HTML, renders to:
Inline math
Example input:
Test `1+1=2` or ``2+2=4``. Optional: `math 3+3=6`.
Usage
markdown-it-asciimath converts ASCII-math to TeX and then uses KaTeX to render the math. The ASCII-math - TeX conversion is done using the ASCIIMathML Scripts. The following file needs to be included:
<script src="./node_modules/markdown-it-asciimath/ASCIIMathTeXImg.js"></script>
The plugin uses KaTeX to render TeX-math so the KaTeX stylesheet needs to be included:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css">
To use the plugin:
var md = require('markdown-it')();
md.use(require("markdown-it-asciimath"));
LaTeX math code can be rendered, too. Just use the keyword latex
instead of math
.
Options
Options can be specified:
md.use(require("markdown-it-asciimath"), options);
Now only this option is available:
Name | Description | Default
------------------|----------------------------------------------------------------------|------------------------------------
"useKeyword" | Use the keywords math
and latex
to specify inline math syntax | false