我選擇的這個主題沒有自帶數學渲染器,(但寫文章怎麼能沒有 latex 呢),所以就尋找安裝 latex 辦法這裡給出一種簡單方法。qwq
安裝#
$ npm install hexo-filter-mathjax
$ hexo clean
配置#
在博客目錄下的_config.yml 內添加
mathjax:
tags: none # or 'ams' or 'all'
single_dollars: true # 單個美元符號是否運用latex
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 #如果設為true,每個頁面都會加載mathjax 建議關閉
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
在需要加載 latex 的 front-matter 寫入mathjax: true
注意#
- 單個美元符號引入的公式美元符號,開頭的 $ 後和結尾的 $ 前不能有空格
- 如果 latex 內符號和 markdown 語法有衝突 請用 \ 轉義 如 * 要寫成 \*
- this 可以將你的 latex 轉義