Note: This is a general markdown-it math plugin. It was originally designed to render MathML. If you intend to use MathJax, markdown-it-mathjax might be a better choise.
markdown-it-math
Pythagoran theorem is $$a^2 + b^2 = c^2$$. Bayes theorem: $$$P(A | B) = (P(B | A)P(A)) / P(B)$$$
Pythagoran theorem is a2+b2=c2.Bayes theorem:PA|B=PB|APAPB
Installation
npm install markdown-it-math --save
Usage
var md = ;
where options can be (with defaults)
var options = inlineOpen: '$$' inlineClose: '$$' blockOpen: '$$$' blockClose: '$$$' renderingOptions: {} inlineRenderer: thisrendererOptions blockRenderer: Object
(See ascii2mathml for reference about the default renderer).
Examples
Using comma as a decimal mark
var md = ; md;// <p><math><mn>40,2</mn></math></p>
Using TeXZilla as renderer
var texzilla = ;var md = ; md;// <p><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo lspace="0em" rspace="0em">sin</mo><mo stretchy="false">(</mo><mn>2</mn><mi>π</mi><mo stretchy="false">)</mo></mrow><annotation encoding="TeX">\sin(2\pi)</annotation></semantics></math></p>
Using LaTeX style delimiters
var md =
Note there are restrictions on what inline delimiters you can use, based on optimization for the markdown-it parser see here for details. And block level math must be on its own lines with newlines separating the math from the delimiters.
Some text with inline math \(a^2 + b^2 = c^2\) And block math \[e = sum_(n=0)^oo 1/n!\]