一、引言
Hexo作为一个优秀的Markdown博客框架,自然也诞生了很多适用的Markdown渲染器,这里对比分析一下Hexo下几种常用的Markdown渲染器:hexo-renderer-marked
,hexo-renderer-kramed
,hexo-renderer-pandoc
,hexo-renderer-markdown-it
,hexo-renderer-markdown-it-plus
,本文使用的渲染器为:hexo-renderer-markdown-it-plus
。
二、详细介绍
2.1、hexo-renderer-marked
Hexo默认的Markdown的渲染器,针对于普通的Markdown的文章书写,该渲染器已经足够,但是由于不支持Mathjax,不支持插件扩展,不支持emoji表情,所以该渲染器也是介绍的渲染器中功能最弱的。
-
GitHub地址:hexojs/hexo-renderer-marked
-
NPM地址:hexo-renderer-marked
版本
:2.0.0最近提交
:a month ago依赖
:hexo-util,marked,strip-indent
-
安装方式:
npm install hexo-renderer-marked —save
2.2、hexo-renderer-kramed
基于hexo-renderer-marked二次开发的渲染器,完善了对Mathjax的支持,仍然不支持插件的扩展,不支持emoji表情。
-
GitHub地址:sun11/hexo-renderer-kramed
-
NPM地址:hexo-renderer-kramed
版本
:0.1.4最近提交
:2 years ago依赖
:hexo-util、kramed、object-assign、strip-indent
-
安装方式:
npm install hexo-renderer-kramed --save
2.3、hexo-renderer-pandoc
与hexo-renderer-marked类似,支持Mathjax语法,不仅可以渲染markdown,还支持textile,reStructedText和许多其他格式,仍然不支持emoji表情;内建的汇总文件db.json
将来可能会非常大,同步到 Github 可能会比较慢,博客内建的搜索功能也可能会变得非常慢。
-
GitHub地址:wzpan/hexo-renderer-pandoc
-
NPM地址:hexo-renderer-pandoc
版本
:0.1.4最近提交
:2 years ago依赖
:无
-
安装方式:
npm install hexo-renderer-pandoc --save
2.4、hexo-renderer-markdown-it
支持Mathjax语法(支持不太好),支持Markdown以及CommonMark语法,渲染速度比hexo-renderer-marked快,支持插件配置,支持标题带安全的id信息,支持脚注(上标,下标,下划线)。
-
GitHub地址:hexojs/hexo-renderer-markdown-it
-
NPM地址:hexo-renderer-markdown-it
版本
:3.4.1最近提交
:4 years ago依赖
:较多…
-
安装方式:
npm i hexo-renderer-markdown-it —save
2.5、hexo-renderer-markdown-it-plus
支持Katex插件并默认启用,默认启用插件列表:markdown-it-emoji
,markdown-it-sub
,markdown-it-sup
,markdown-it-deflist
,markdown-it-abbr
,markdown-it-footnote
,markdown-it-ins
,markdown-it-mark
,@iktakahiro/markdown-it-katex
,markdown-it-toc-and-anchor
。
-
安装方式:
npm i hexo-renderer-markdown-it-plus —save