0%

next中katex不显示的问题

经过一个上午的折腾终于整明白了怎么在hexo中用mathjax渲染。

NexT 主题的 MathJax 插件默认是禁用的
在主题配置文件_config.yml中找到如下代码段

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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: true

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

# hexo-renderer-markdown-it-plus (or hexo-renderer-markdown-it with markdown-it-katex plugin) required for full Katex support.
katex:
enable: false
# See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex
copy_tex: false

将对应的enable的值改为true即可启用 MathJax。
同时注意 per_page 上面的注释,注释表明了,MathJax 只渲染在文件前端注明 mathjax: true 字段的文章,例如:

1
2
3
4
5
6
7
8
---
layout: hexo
title: next中katex不显示的问题
date: 2020-05-29 14:43:03
tags: [hexo]
categories: [问题]
mathjax: true
---

接下来就可以愉快的使用mathjax了~