markdown-it-maths is a markdown-it plugin for processing and rendering KaTeX and AsciiMath directly into your document. It ships with all the fonts and stylesheets required for an offline usage.
$ npm install markdown-it-maths
// Create a markdown-it instance:
const md = require("markdown-it")();
// …and use maths without any configuration required!
md.use(require("markdown-it-maths"));
Lorem ipsum `math a/b + c/d = e/f` dolor stuff.
Lorem ipsum `katex \frac{a}{b} + \frac{c}{d} = \frac{e}{f}` dolor stuff.
Lorem ipsum dolor stuff:
```math
a/b + c/d = e/f
```
Lorem ipsum dolor stuff:
```katex
\frac{a}{b} + \frac{c}{d} = \frac{e}{f}
```
Note: you can use the keyword
latex
instead ofkatex
.