最开始是想要引入emoji,在网上搜到用hexo-renderer-markdown-it的方法,确实好使,然后后来又在其他地方看到了其他的渲染器,貌似比hexo-renderer-markdown-it更好,所以更新了这篇文章
hexo-renderer-markdown-it的使用
安装
删除原有的markdown渲染引擎:npm un hexo-renderer-marked --save
安装新的支持emoji的引擎: npm i hexo-renderer-markdown-it markdown-it-emoji --save
配置
Hexo站点配置文件_config.yml中,增加markdown相关配置:
markdown:
render:
html: true
xhtmlOut: false
breaks: true
linkify: true
typographer: true
quotes: '“”‘’'
plugins:
- markdown-it-footnote
- markdown-it-sup
- markdown-it-sub
- markdown-it-abbr
- markdown-it-emoji
anchors:
level: 2
collisionSuffix: 'v'
permalink: true
permalinkClass: header-anchor
permalinkSymbol: ¶
就可以使用emoji了,感谢这位博主 银河小徐 的文章~
原文链接是:https://hasaik.com/posts/9b280ea3.html
文章中还有emoji编码合集,特别方便~
@upupming/hexo-renderer-markdown-it-plus的使用
各个渲染器,在这篇文章有讲:https://blog.csdn.net/qq_36667170/article/details/105846999
对比起来,目前看起来最好的应该是这个渲染器@upupming/hexo-renderer-markdown-it-plus
安装
- 删除其他的
markdown渲染引擎 - 如果之前有安装
markdown-it-emoji也可以删除,因为@upupming/hexo-renderer-markdown-it-plus默认是支持emoji的 - 安装
@upupming/hexo-renderer-markdown-it-plus:npm i @upupming/hexo-renderer-markdown-it-plus --save
配置
Hexo站点配置文件_config.yml中,修改markdown相关配置为:
markdown_it_plus:
render:
html: true
xhtmlOut: false
breaks: true
linkify: true
typographer: true
quotes: '“”‘’'
plugins:
anchors:
level: 2
collisionSuffix: 'v'
permalink: true
permalinkClass: header-anchor
permalinkSide: 'left'
permalinkSymbol: ¶
就可以了
