Hexo 公式渲染踩坑

  1. renderer选择
  2. 渲染冲突问题

renderer选择

解决多行公式(如矩阵)无法渲染问题

我的 node_modules :

  • hexo-filter-mathjax
  • hexo-renderer-ejs
  • hexo-renderer-kramed
  • hexo-renderer-pandoc
  • hexo-renderer-stylus

_config.yml 中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# MathJax
mathjax:
tags: none # or 'ams' or 'all'
single_dollars: true # enable single dollar signs as in-line math delimiters
cjk_width: 0.9 # relative CJK char width
normal_width: 0.6 # relative normal (monospace) width
append_css: true # add CSS to pages rendered by MathJax
every_page: false # if true, every page will be rendered by MathJax regardless the `mathjax` setting in Front-matter
packages: # extra packages to load
extension_options: {}
# you can put your extension options here
# see http://docs.mathjax.org/en/latest/options/input/tex.html#tex-extension-options for more detail
# hexo-admin authentification

pandoc:
pandoc_path: D:/pandoc/pandoc.exe

渲染冲突问题

如将 Latex 中下划线渲染为斜体

解决方法:

node_modules.js 中

1
2
3
4
5
6
# line 11
- escape: /^\\([\\`*{}\[\]()#$+\-.!_>])/,
+ escape: /^\\([`*\[\]()#$+\-.!_>])/
# line 20
- em: /^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
+ em: /^\*((?:\*\*|[\s\S])+?)\*(?!\*)/