0%

next主题数学公式问题

next主题数学公式问题

虽然我写的都是一些编程相关的文章,但是有些文章里还是存在数学公式的,我在Typora软件中写的时候显示的是对的,但是hexo将markdown转为html后在页面上就没有数学公式的格式了。

查找next配置发现有一个渲染数学公式的配置

1
2
3
4
5
6
7
8
9
10
11
12
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.
# 设置为true,就只渲染那些配置了mathjax: true的页。如果设置为false,会渲染所有页,影响性能
per_page: true
# npm install hexo-renderer-kramed --save
# hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support.
mathjax:
enable: true
# See: https://mhchem.github.io/MathJax-mhchem/
mhchem: false

math.mathjax.enable设置为true。需要安装hexo-renderer-kramed

1
npm install hexo-renderer-kramed --save

然后在对应的需要数学公式渲染的文章上加上mathjax: true

1
2
3
4
5
6
7
8
9
---
title: 排序算法
author: ZH
date: 2021-01-12 17:57:23
tags:
- 数据结构与算法
categories: 数据结构与算法
mathjax: true
---

看一篇文章说是需要先将hexo-renderer-marked卸载掉,这个我回头试一下是否需要卸载

1
npm uninstall hexo-renderer-marked --save

这个测了一下,不需要将之前的卸载掉,两者不冲突

欢迎关注我的其它发布渠道