Skip to content

quertt/markdown-it-asciimath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

math output

Please note: adding a single empty line between two expressions makes them render individually. Otherwise, they are rendered as one expression (this adds support for multiline expressions like matrices).

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

About

Markdown-it plugin to include ascii-math

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published