替换Marked
hexo 默认的渲染引擎是marked,但是 marked 不支持 MathJax。 pandoc和kramed ,能够支持MathJax。
先卸载原来默认的渲染引擎hexo-renderer-marked,然后安装hexo-renderer-pandoc
1 | yarn remove hexo-renderer-marked |
安装 hexo-renderer-pandoc 还需要安装 pandoc (version >=2.0) 渲染器支持,Arch 安装: sudo pacman -S pandoc
hexo-renderer-kramed 是基于 hexo-renderer-marked 改的,所以不用单独安装渲染器,但 next 官方不推荐使用。
配置
博客目录下
1 | vim themes/next/_config.yml |
找到math配置项开启
1 | # Math Formulas Render Support |
在需要使用Mathjax的文章Front-matter中添加mathjax: true
1 | --- |
方案2
另一种方案是使用hexo-renderer-markdown-it-plus