hexojs / hexo-renderer-markdown-it

Markdown-it is a Markdown parser, done right. A faster and CommonMark compliant alternative for Hexo.
MIT License
343 stars 60 forks source link

hexo-renderer-markdown-it中如何解决markdown和mathjax之间的冲突呢? #74

Closed weidongzhou1994 closed 4 years ago

weidongzhou1994 commented 5 years ago

在使用hexo-renderer-markdown-it的过程中,数学公式的输入使我头疼,如$ \sum_{i=0}^{n}i^2 $不能在hexo显示出正确的格式,该怎么解决呢?

stevenjoezhang commented 4 years ago

\转义

$ \sum_{i=0}^{n}i^2 $
$ \sum\_{i=0}^{n}i^2 $
Qinka commented 4 years ago

我从 https://github.com/classeur/markdown-it-mathjax fork了一份,然后进行了修改 https://github.com/Qinka/markdown-it-mathjax-skip ,但是没有传到 npm 上,依赖加上后在 plugins 中加上 markdown-it-mathjax-skip 就好了。 (原始的那个没办法被作为插件使用,我修改的内容只是让那个可以作为插件使用)

markdown:
  render:
    html: true
    xhtmlOut: false
    breaks: false
    linkify: true
    typographer: true
    quotes: '“”‘’'
  plugins:
    - markdown-it-mathjax-skip
    - markdown-it-abbr
    - markdown-it-footnote
    - markdown-it-ins
    - markdown-it-emoji
    - markdown-it-sub
    - markdown-it-sup
  anchors:
    level: 2
    collisionSuffix: ''
    permalink: false
    permalinkClass: 'header-anchor'
    permalinkSide: 'left'
    permalinkSymbol: '¶'
    case: 0
    separator: ''
MakerGYT commented 4 years ago

@weidongzhou1994 @Qinka 试试markdown-it-latex2img

$\sum_{i=0}^{n}i^2$