Markdown-it

  Hexo需要使用Markdown渲染引擎将md文件渲染成HTML文件,Hexo默认使用 hexo-renderer-marked ,可以换成 hexo-renderer-markdown-it .
  hexo-renderer-markdown-it拥有更好的性能,而且可以通过插件扩展功能,如: 上标、下标、引用注脚、emoji、KaTex公式、多维表格等。

Hexo中Markdown-it 安装与配置

  1.卸载Hexo默认引擎

npm un hexo-renderer-marked --save

  2.安装markdown-it引擎

npm i hexo-renderer-markdown-it --save

  3.在站点配置文件_config.yml中增加以下配置,配置信息含义见说明文档;https://github.com/hexojs/hexo-renderer-markdown-it#options

markdown:
  preset: 'default'
  render:
    html: true
    xhtmlOut: true
    breaks: true
    langPrefix: 'language-'
    linkify: true
    typographer: true
    quotes: '“”‘’'
  plugins:
    - 'markdown-it-footnote'
    - 'markdown-it-ins'
    - 'markdown-it-mark'
    - 'markdown-it-sub'
    - 'markdown-it-sup'

  本站点目前无此需求,故未安装Markdown-it, 具体效果请参考 PANOSHU: Hexo Stellar 和 Next 主题支持Katex公式与Markdown复杂表格

KaTex公式插件安装与配置

  KaTex是一款轻量化的公式渲染器,使用和配置如下:
  1.安装markdown-it-katex插件

npm i @traptitech/markdown-it-katex --save

  2.添加配置
  在站点配置文件 _config.yml中增加markdown-it 的插件配置

plugins:
  - plugin:
    name: '@traptitech/markdown-it-katex'
    options: # see https://katex.org/docs/options.html
      blockClass: "math-block"
      strict: false
      throwOnError: false
      errorColor: "#cc0000"

  该插件本网站已实装

复杂的Markdown表格

  Markdown原生只支持最简单的表格,不支持合并单元格表格,通过安装插件支持。

复杂的Markdown表格

  Markdown原生只支持最简单的表格,不支持合并单元格表格,通过安装插件支持。
  1.安装markdown-it-multimd-table插件

npm i markdown-it-multimd-table --save

  2.添加配置
  在站点配置文件 _config.yml中增加markdown-it的插件配置

plugins:
  - plugin:
    name: markdown-it-multimd-table
    enable: true
    options:
      multiline: true
      rowspan: true
      headerless: true

  3.用法与效果

\ | Markdown | Rendered HTML |
\ |————–|—————|
\ | Italic | Italic |
\ | | |
\ | - Item 1 | - Item 1 |
\ | - Item 2 | - Item 2 |
\ | python | python
\ | .1 + .2 | .1 + .2
\ | | |

Markdown Rendered HTML
Italic Italic
- Item 1 - Item 1
- Item 2 - Item 2
```python ```python \
.1 + .2 .1 + .2 \
``` ```

Stage | Direct Products | ATP Yields
-—: | ————–: | ———:
Glycolysis | 2 ATP ||
^^ | 2 NADH | 3–5 ATP |
\Pyruvaye oxidation | 2 NADH | 5 ATP |
\Citric acid cycle | 2 ATP ||
^^ | 6 NADH | 15 ATP |
^^ | 2 FADH2 | 3 ATP |
30–32 ATP |||
[Net ATP yields per hexose]

Stage Direct Products ATP Yields
Glycolysis 2 ATP
^^ 2 NADH 3–5 ATP
Pyruvaye oxidation 2 NADH 5 ATP
Citric acid cycle 2 ATP
^^ 6 NADH 15 ATP
^^ 2 FADH2 3 ATP
30–32 ATP
[Net ATP yields per hexose]

|–|–|–|–|–|–|–|–|
|♜| |♝|♛|♚|♝|♞|♜|
| |♟|♟|♟| |♟|♟|♟|
|♟| |♞| | | | | |
| |♗| | |♟| | | |
| | | | |♙| | | |
| | | | | |♘| | |
|♙|♙|♙|♙| |♙|♙|♙|
|♖|♘|♗|♕|♔| | |♖|

|–|–|–|–|–|–|–|–|
|♜| |♝|♛|♚|♝|♞|♜|
| |♟|♟|♟| |♟|♟|♟|
|♟| |♞| | | | | |
| |♗| | |♟| | | |
| | | | |♙| | | |
| | | | | |♘| | |
|♙|♙|♙|♙| |♙|♙|♙|
|♖|♘|♗|♕|♔| | |♖|


本站总访问量

免责声明

本站提供的一切软件、教程和内容信息仅限用于学习和研究目的。

不得将上述内容用于商业或非法用途,否则一切后果自负。

本站信息来自网络收集整理,版权争议与本站无关。

如果有侵权之处请第一时间联系站长删除。敬请谅解!