People who are crazy enough to think they can change the world, are the ones who do.
— Apple Computers
hexo-renderer-markdown-it
的速度要比 hexo-renderer-marked
原装插件要快,而且功能更多
首先进入博客目录,卸载hexo默认的 marked
渲染器,安装 markdown-it
渲染器,运行的命令如:
1 2
| $ npm un hexo-renderer-marked --save $ npm i hexo-renderer-markdown-it --save
|
标准配置说明
这里有一份标准配置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
markdown: render: html: true xhtmlOut: false breaks: true linkify: true typographer: true quotes: "“”‘’" plugins: - markdown-it-abbr - markdown-it-footnote - markdown-it-ins - markdown-it-sub - markdown-it-sup anchors: level: 1 collisionSuffix: "v" permalink: false permalinkClass: header-anchor permalinkSymbol: ˃
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| - level:生成 Heading ID 的标题等级 - collisionSuffix:Heading ID 重复时,数字的后缀 - permalink:'true',则创建一个锚标记,除标题外还有一个固定链接 - permalinkClass:用于固定链接锚标记的样式 - permalinkSymbol:用于固定链接标记的符号
若想更改 `permalinkSymbol` 里面符号,可以参考:[permalinkSymbol](https://graphemica.com/unicode/characters)
注:如果不想显示 `permalinkSymbol` 的符号,可以改 `permalink: true` 为 `permalink: false` 即可
- html:定义文档中的HTML内容是否应转义或传递给最终结果。 html: true # 不转义 HTML 内容 html: false # 转义 HTML 内容,使标签作为文本输出
- xhtmlOut:定义解析器是否将导出完全兼容XHTML的标记。 xhtmlOut: true # 必须使用完全的 XHTML 代码,换行必须为 <br/> xhtmlOut: false # 不必必使用完全的 XHTML 代码,换行可以为 <br>
- breaks:使源文件中的换行符被解析为<br>标记。每次按Enter键都会创建换行符。 breaks: true # 每次会车换行相当于一个 <br/> 标签 breaks: false # Pa每次会车换行会被忽略
- linkify:解析器能够将直接粘贴到文本中的链接内联。 linkify: true # 类似链接的文本,作为链接输出 linkify: false # 类似链接的文本,依然作为文本输出
- typographer:可以替换常见的排版元素。 typographer: true # 替换常见的排版元素 typographer: false # 不替换常见的排版元素
- quotes:单引号、双引号如何被替换 quotes: '“”‘’' # 'single'、"double" 变成 ‘single’、“double” quotes: '«»“”' # 'single'、"double" 变成 “single”、«single»
|
使用markdown-it-emoji
hexo-配置使用emoji
使用wiki links插件
hexo-url-link-wikilink-obsidian-解决方案