Fork me on GitHub

Hexo支持MathJax

1.更换markdown渲染引擎

1
2
$ npm uninstall hexo-renderer-marked --save
$ npm install hexo-renderer-pandoc --save

2.主题中开启MathJax开关

编辑主题 _config.yml 文件:

1
2
3
4
# MathJax Support
mathjax:
enable: true
per_page: true

3.打开文章的MathJax开关

1
2
3
4
5
6
---
title: XXX
date: XXX
tags:
mathjax: true
--

测试

  • $$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$

  • \Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr)$$\Biggl(\biggl(\Bigl(\bigl((x)\bigr)\Bigr)\biggr)\Biggr)$$

  • \left(\frac{\sqrt x}{y^3}\right)$$\left(\frac{\sqrt x}{y^3}\right)$$