Welcome to PhYsiX Space

Try to set up a place to store notes

0%

基于Hexo使用NexT主题的博客恢复以及启用mathjax的办法

恢复博客

下载Git仓库中的历史版本文件,解压到目标本地文件夹或直接git-clone

Git bash重新安装hexo

rm -rf node_modules
npm install --force

额外备份了主题文件夹,直接将备份的next主题文件夹覆盖theme中的文件夹

接下来hexo clean, g, s, d普通操作就可以了

启用mathjax

next文件夹中的_config.yml文件mathjax设为true

安装hexo-renderer-pandoc

$ npm un hexo-renderer-marked
$ npm i hexo-renderer-pandoc

打开 Hexo 项目目录下的 themes/next/layout/_layout.swig 文件。

在该文件的 <head> 标签中添加以下代码

<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
</script>

\[\begin{equation} e=mc^2 \end{equation}\]

The famous matter-energy equation proposed by Einstein...

This is an inline math expression: \(E=mc^2\). This is a displayed math expression: \[ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} \]