README
This is a markdown-it-mathjax-node
Call Mathjax-node to render math formula in markdown-it. Used deasync to bypass the markdown-it async only rule.
var md = require('markdown-it')()
.use(require('markdown-it-mathjax-node'));
let res = md.render('$a_i e^2$。')
console.log(res)
// <p>\[x & (-x) = 1000_{(2)} = 8_{(10)}\] 。</p>
check test.js for more
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)
$$
<p>Pythagoran theorem is <math><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup><mo>=</mo><msup><mi>c</mi><mn>2</mn></msup></math>.</p>
<p>Bayes theorem:</p>
<math display="block"><mi>P</mi><mfenced open="(" close=")"><mrow><mi>A</mi><mo stretchy="true" lspace="veryverythickmathspace" rspace="veryverythickmathspace">|</mo><mi>B</mi></mrow></mfenced><mo>=</mo><mfrac><mrow><mi>P</mi><mfenced open="(" close=")"><mrow><mi>B</mi><mo stretchy="true" lspace="veryverythickmathspace" rspace="veryverythickmathspace">|</mo><mi>A</mi></mrow></mfenced><mi>P</mi><mfenced open="(" close=")"><mi>A</mi></mfenced></mrow><mrow><mi>P</mi><mfenced open="(" close=")"><mi>B</mi></mfenced></mrow></mfrac></math>
Installation
npm install markdown-it-math --save
Usage
var md = require('markdown-it')()
.use(require('markdown-it-math') [, options]);
where options can be (with defaults)
var options = {
inlineOpen: '$',
inlineClose: '$',
blockOpen: '$