MathJax rendering

To render math without escaping \ or _, you might want to replace the default Markdown renderer (hexo-renderer-marked).

Setup

Some of the guide is from Hexo Next docs

Uninstall the default Markdown renderer (hexo-renderer-marked) since it treats \ and _ character with Markdown syntax.

1
npm un hexo-renderer-marked

Option 1: hexo-renderer-pandoc

pandoc need to be installed in your PATH.

1
npm i hexo-renderer-pandoc

Option 2: hexo-renderer-markdown-it

Install markdown-it-katex with hexo-renderer-markdown-it as stated here 📄.

However, I would suggest another plugin, markdown-it-latex2img📦, which does server-side rendering of math formulae, powered by https://math.now.sh/

1
npm i hexo-renderer-markdown-it markdown-it-latex2img
_config.yml
1
2
3
4
5
# _config.yml
markdown:
plugins:
- markdown-it-latex2img
- (other plugins...)

MathJax rendering

For syntax, see MathJax quick reference 📄.

The delimiters $, $$ rendering follows pandoc rule.

Inline math

  • Pythagoras theorem:
  • Sum of arithmetic sequence:
  • Fundamental theorem of calculus:
  • Binomial distribution:

Block math

Normaldistribution :

Fibonacci Sequence , the ratio of two consecutive numbers converges to golden ratio

Factorisation

Dirichlet function

Gauss’s law

Vandermonde matrix

System of linear equations

Physics

  • Newton’s first law:
  • Newton’s second law:
  • Newton’s third law:
  • Mass–energy equivalence:

Law of gravity:

Kirchhoff Laws

Second lawof thermodynamics

Chemistry

Ions and precipitation:

Ammonia synthesis (notice the arrow length is not adjustable in Mathjax)

Equilibrium constant:

Biology

Photosynthesis