1.在hexo/_config.yml末尾添加一段代码

1
2
3
4
5
6
math:
engine: 'mathjax' # or 'katex'
mathjax:
# src: custom_mathjax_source
config:
# MathJax config

2.修改next/_config.yml中mathjax的设置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Math Formulas Render Support
math:
# Default (true) will load mathjax / katex script on demand.
# That is it only render those page which has `mathjax: true` in Front-matter.
# If you set it to false, it will load mathjax / katex srcipt EVERY PAGE.
per_page: false

# hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support.
mathjax:
enable: true
# See: https://mhchem.github.io/MathJax-mhchem/
mhchem: false

vendors:
mathjax: //cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML

注意:如果per_page:false则md文件前面要加上mathjax:true


3.额外装hexo-filter-mathjax

$ npm i hexo-filter-mathjax