咨询是否支持mathjax
您好,我使用您提供的模板搭建了hexo博客,感谢您的分享。
最近我要在博客中集成使用mathjax插件,一直无法生效,网上查阅各种资料还是不能好用,请问这套模板支持mathjax吗?谢谢
目前是没有相关功能的,之前想过加上,因为懒一直还没开始动手。
目前是没有相关功能的,之前想过加上,因为懒一直还没开始动手。
作者支持你,感谢你的无私分享,期待早一天能实现这个功能!
如果要修改支持的话,您建议怎么修改吗?
现在也有这种hexo 插件,不过我不太清楚要支持怎么修改,请指导一下,谢谢
https://github.com/phoenixcw/hexo-renderer-mathjax
https://ranmaosong.github.io/2017/11/29/hexo-support-mathjax/
我研究了下,以下操作不涉及对主题的修改
一、安装 hexo-math 插件
$ npm install hexo-math
二、增加站点配置:_config.yam
math:
engine: 'mathjax'
mathjax:
src: 'https://cdn.bootcss.com/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
config:
tex2jax:
inlineMath:
- - '$'
- '$'
- - '\\('
- '\\)'
processEscapes: true
TeX:
equationNumbers:
autoNumber: 'AMS'
三、添加测试文章
---
title: Test MathJax
---
$$ \sqrt{2} $$
四、查看效果
$ hexo server
打开测试文章,如果不出意外将会看到一个根号二。
你试下可以不,没问题的话我把这个加到 README.md 小提示里边
感谢您的反馈,我测试了一下,没达到效果 $$ \sqrt{2} $$ 原样输出了

我的配置是: package.json:
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"hexo": {
"version": "3.8.0"
},
"dependencies": {
"hexo": "^3.8.0",
"hexo-asset-image": "git+https://github.com/CodeFalling/hexo-asset-image.git",
"hexo-deployer-git": "^1.0.0",
"hexo-filter-flowchart": "^1.0.4",
"hexo-filter-mermaid-diagrams": "^1.0.5",
"hexo-generator-archive": "^0.1.5",
"hexo-generator-category": "^0.1.3",
"hexo-generator-index": "^0.2.1",
"hexo-generator-tag": "^0.2.0",
"hexo-inject": "^1.0.0",
"hexo-math": "^3.0.4",
"hexo-renderer-ejs": "^0.3.1",
"hexo-renderer-less": "^1.0.0",
"hexo-renderer-marked": "^2.0.0",
"hexo-renderer-stylus": "^0.3.3",
"hexo-server": "^0.3.3",
"hexo-tag-plantuml": "^1.0.0"
}
}
themes/concise/_config.yml
math:
engine: 'mathjax'
mathjax:
src: 'https://cdn.bootcss.com/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
config:
tex2jax:
inlineMath:
- - '$'
- '$'
- - '\\('
- '\\)'
processEscapes: true
TeX:
equationNumbers:
autoNumber: 'AMS'
我再执行hexo 命令的时候貌似可以看到加载mathjax引擎了:
ZBMAC-0d3e1bb56:source test$ hexo s
INFO [hexo-math] Using engine 'mathjax'
INFO Start processing
INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.
可能还是哪里使用不对导致没生效?您方便再看看吗?
放到 /_config.yml 站点配置中,不要放到主题的配置 themes/concise/_config.yml

OK,可以了,根号二显示了,我试了几个复杂的,也可以显示了,非常非常感谢!
不客气
@sanonz hexo-inject 效率很低,会大幅度降低hexo g的速度,希望主题能够集成mathjax 3配置文件