hexo配置latex
Hexo配置Latex
我们用hexo+aliyun搭建个人博客,会发现无法显示markdown文件里的latex公式,这是因为hexo默认支持的hexo-renderer-marked渲染器不支持latex公式。那我们应该怎样做才能支持显示latex公式呢?以butterfly主题为例,目前butterfly支持两种数学公式渲染引擎,分别为Mathjax和Katex。由于Mathjax支持的更为全面,因此我们选择Mathjax。
卸载hexo-math和hexo-renderer-marked。在git bash中输入如下命令
1
2npm un hexo-math
npm un hexo-renderer-marked安装hexo-renderer-pandoc渲染器,命令如下:
1
npm i hexo-renderer-pandoc
修改配置文件,修改
_config.yml
中mathjax
的设置,如下:1
2
3
4math:
mathjax:
enable: true
per_page: true本地下载pandoc,否则
hexo g
会报错pandoc exited with code null
1
yum install pandoc
下载之后
hexo g
还是会报错。这是因为我们pandoc版本低了。1
2
3wget https://github.com/jgm/pandoc/releases/download/2.14.0.3/pandoc-2.14.0.3-linux-amd64.tar.gz
tar -xvf pandoc-2.14.0.3-linux-amd64.tar.gz
mv ./pandoc-2.14.0.3/bin/pandoc /usr/bin/pandoc执行
hexo clean
,hexo g
,hexo s
就可以成功渲染latex啦!
此文章版权归waar299所有,如有转载,请注明来自原作者!
评论