让Hexo支持上标、下标、脚注和数学公式

dr_pure Lv5

markdown-it可以给Hexo增加上标、下标、脚注等功能。
math可以让hexo显示数学公式。

Markdown-it的主要特性

  • Support for [Markdown], [GFM] and [CommonMark]
  • Extensive configuration
  • Faster than the default renderer | hexo-renderer-marked
  • Safe ID for headings
  • Anchors for headings with ID
  • Footnotes
  • <sub> H2O
  • <sup> x2
  • <ins> Inserted

安装方法

1、安装插件,在站点目录执行

1
2
3
npm un hexo-renderer-marked --save
npm i hexo-renderer-markdown-it --save
npm i markdown-it-katex --save

2、修改站点配置,在_config.yml中添加markdown字段,内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
markdown:
render:
html: true
xhtmlOut: false
breaks: false
linkify: false
typographer: true
quotes: '“”‘’'
plugins:
- markdown-it-abbr
- markdown-it-footnote
- markdown-it-ins
- markdown-it-sub
- markdown-it-sup
- markdown-it-katex

配置文件的详情可以看官方wiki

  • 标题: 让Hexo支持上标、下标、脚注和数学公式
  • 作者: dr_pure
  • 创建于 : 2018-11-23 01:00:00
  • 更新于 : 2018-11-23 01:00:00
  • 链接: https://blog.lfn.moe/posts/4494f03f/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论
目录
让Hexo支持上标、下标、脚注和数学公式