title: {{ title }} date: {{ date }} tags: - categories: - + mathjax: false
文章需要渲染数学公式时改为true就行了。
使用Katex
使用markdown-it-plus代替marked
安装插件:
~/博客根目录
1 2
$ npm un hexo-renderer-marked --save $ npm i hexo-renderer-markdown-it-plus --save
配置
在主题配置文件里设置:
~/next/_config.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# Math Formulas Render Support math: enable:true # 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:true#如果这个选项是false,那么每一个网页都会引入公式渲染,这是很浪费的,只需要在需要公式渲染功能的博文md文件的头部,添加一行`mathjax: true`(使用Katex引擎渲染也是在文件头部标记`mathjax: true`,表示支持公式)
# hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support. mathjax: enable:false # See: https://mhchem.github.io/MathJax-mhchem/ mhchem:false
# hexo-renderer-markdown-it-plus (or hexo-renderer-markdown-it with markdown-it-katex plugin) required for full Katex support. katex: enable:true # See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex copy_tex:false