Candinya / Kratos-Rebirth

一个可爱而现代的 Hexo 主题
GNU General Public License v3.0
638 stars 79 forks source link

将hexo渲染器替换为hexo-renderer-markdown-it-katex 无法渲染形如$$...$$的双$公式。 #89

Closed hcxx closed 2 years ago

hcxx commented 2 years ago
  1. 对Bug的描述: 将hexo渲染器替换为hexo-renderer-markdown-it-katex 可以渲染$...$的公式,但是无法渲染形如$$...$$的双$公式。展示为纯文本

  2. 复现Bug的方法: a. 替换官方渲染器:

    npm un hexo-renderer-marked --save
    npm i hexo-renderer-markdown-it-katex --save

       b. 修改主题_config.yml配置文件(实测不修改也是一样的效果)

    markdown:
    render:
    html: true
    xhtmlOut: false
    breaks: true
    linkify: true
    typographer: false
    quotes: '“”‘’'
    plugins:
    anchors:
    level: 2
    collisionSuffix: ''
  3. 期望的行为: $$...$$数学公式居中显示

  4. 相关的截图: 其中加粗的二进制数为$...$公式,双$$...$$公式展示如图纯文本

  5. 运行环境(如果该Bug的产生和环境有关,例如浏览器不兼容导致):

    • 操作系统: win10 20H1
    • 浏览器: Microsoft Edge
    • 版本: 95.0.1020.30 (官方内部版本) (64 位)
  6. 补充内容: 是否需要额外配置才能生效。

Candinya commented 2 years ago

无法复现,请检查是否可能有冲突的插件,如 hexo-math ,或是 hexo-renderer-mathjax

image

另,由于该部分渲染配置非主题来完成,涉及配置文件的修改大概需要放置在站点配置文件中。

hcxx commented 2 years ago

image image

手动空格居中会出问题,但是不居中就没问题

Candinya commented 2 years ago

可能是渲染器的判断逻辑导致,行前无空格的会被自动渲染为居中的样式 image

hcxx commented 2 years ago

可能是渲染器的判断逻辑导致,行前无空格的会被自动渲染为居中的样式 image

好的,感谢。