304 字
2 分钟
Hexo 4 更多Markdown语法
前言
我现在用的 Markdown 渲染器是 hexo-renderer-markdown-it,相比较 Hexo 默认的渲染器 hexo-renderer-marked,它的渲染速度更快、功能更丰富,例如它支持 注脚、下划线 等高级语法,这是默认的渲染器所不具备的,因此写作会更加方便。
安装 hexo-renderer-markdown-it
首先,卸载原来默认的渲染器:
npm uninstall hexo-renderer-marked
然后,安装 hexo-renderer-markdown-it:
npm install hexo-renderer-markdown-it
完成后就能用该渲染器对文本进行渲染了,但例如 注脚 等功能需要额外的配置。
安装 Markdown 插件
这里我以 注脚 为例,演示如何安装更多配套的功能插件。
首先,安装 markdown-it-footnote 注脚插件:
npm install markdown-it-footnote
然后,打开 hexo 的 _config.yml 文件进行配置,在 # Extensions 行后增加如下内容:
# hexo-renderer-markdown-itmarkdown: render: plugins: - markdown-it-footnote anchors:
更多的方法可以参考:【Hexo】选择更高级的Markdown渲染器
markdown: preset: "default" render: html: true xhtmlOut: false langPrefix: "language-" breaks: true linkify: true typographer: true quotes: "“”‘’" enable_rules: disable_rules: plugins: - markdown-it-abbr - markdown-it-cjk-breaks - markdown-it-deflist - markdown-it-emoji - markdown-it-footnote - markdown-it-ins - markdown-it-mark - markdown-it-sub - markdown-it-sup - markdown-it-checkbox - markdown-it-imsize - markdown-it-expandable - name: markdown-it-container options: success - name: markdown-it-container options: tips - name: markdown-it-container options: warning - name: markdown-it-container options: danger anchors: level: 2 collisionSuffix: "" permalink: false permalinkClass: "header-anchor" permalinkSide: "left" permalinkSymbol: "¶" case: 0 separator: "-"
Hexo 4 更多Markdown语法
https://fuwari.vercel.app/posts/建站/hexo/hexo-4-更多markdown语法/