Installation

  1. Install the plugin
    1
    2
    npm un hexo-renderer-marked --save # Uninstall the default renderer
    npm i hexo-renderer-markdown-it # Install the advanced renderer
  2. 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
    27
    markdown:
    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

  1. Install the plugin
    1
    npm i @renbaoshuo/markdown-it-katex --save
  2. 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
    28
    markdown:
    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
  3. Modify the theme configuration file
    1
    2
    3
    4
    katex:
    enable: true
    per_page: true # Whether to load on each page
    copytex: true # Whether to enable copy formula