Fast math support for markdown-it with Temml
npm install @traeblain/markdown-it-temmlbash
npm install markdown-it
`
Install the plugin
`bash
npm install @traeblain/markdown-it-temml
`
Use it in your javascript
`javascript
import markdownit from 'markdown-it'
import tml_plugin from '@traeblain/markdown-it-temml'
const md = markdownit()
const tml_plugin = require('@traeblain/markdown-it-temml')
md.use(tml_plugin)
// double backslash is required for javascript strings, but not html input
let result = md.render('# Math Rulez! \n $\\sqrt{3x-1}+(1+x)^2$')
`
Include the Temml stylesheet in your html:
`html
`
If you're using the default markdown-it parser, I also recommend the github stylesheet:
`html
`
$\Large \mathrm{T}\negthinspace\lower2pt{\mathrm{E}}\negthinspace\mathrm{M}\negthinspace\raise2pt{\mathrm{M}}\negthinspace\mathrm{L}$ options can be supplied with the second argument to use.
`javascript
md.use(tml_plugin, {"throwOnError" : false, "errorColor" : " #cc0000"});
`
Additional options are available at Temml's Documentation.
Examples
$3
Surround your LaTeX with a single $ on each side for inline rendering.
`latex
$\sqrt{3x-1}+(1+x)^2$
`
$3
Use two ($$) for block rendering. This mode uses bigger symbols and centers
the result.
`latex
$$\begin{array}{c}
\nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &
= \frac{4\pi}{c}\vec{\mathbf{j}} \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
\nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
\nabla \cdot \vec{\mathbf{B}} & = 0
\end{array}$$
``