Markdown-it
Installation
- Install the plugin
1
2npm un hexo-renderer-marked --save # Uninstall the default renderer
npm i hexo-renderer-markdown-it # Install the advanced renderer - Add configuration information
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
27markdown:
preset: 'default' # Use the MD syntax, default to GFM
render:
html: true # Render html
xhtmlOut: false
langPrefix: 'language-' # Add prefix to the class name in code blocks (when specifying language).
breaks: true
linkify: true # If you write a link instead of [name](link), it will be automatically recognized as a link and rendered.
typographer: true # Replace common printing elements.
quotes: '“”‘’' # Replace "" '' in the article
enable_rules:
disable_rules:
plugins: # Use plugins
anchors:
level: 2 # Render the level of headings (h1, h2, h3)
collisionSuffix: ''
permalink: true
permalinkClass: 'headerlink'
permalinkSide: 'left'
permalinkSymbol: ''
case: 0
separator: '-'
images: # Compilation of images
lazyload: true # Whether lazyload rendering is needed
prepend_root: false
post_asset: false
inline: false
Using Katex
- Install the plugin
1
npm i @renbaoshuo/markdown-it-katex --save
- Modify the Hexo configuration file
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
28markdown:
preset: 'default'
render:
html: true
xhtmlOut: false
langPrefix: 'language-'
breaks: true
linkify: true
typographer: true
quotes: '“”‘’'
enable_rules:
disable_rules:
plugins:
+ - '@renbaoshuo/markdown-it-katex'
anchors:
level: 2
collisionSuffix: ''
permalink: true
permalinkClass: 'headerlink'
permalinkSide: 'left'
permalinkSymbol: ''
case: 0
separator: '-'
images:
lazyload: true
prepend_root: false
post_asset: false
inline: false - Modify the theme configuration file
1
2
3
4katex:
enable: true
per_page: true # Whether to load on each page
copytex: true # Whether to enable copy formula
- Thank you for your appreciation.
List of appreciation
Because of your support, I realized the value of writing articles.
This piece of writing is an original article, utilizing theCC BY-NC-SA 4.0Agreement. For complete reproduction, please acknowledge the source as Courtesy ofSolitude