hexo-theme-stellar icon indicating copy to clipboard operation
hexo-theme-stellar copied to clipboard

圆括号无法显示

Open He1o opened this issue 5 months ago • 4 comments

检查清单

  • [x] 已经阅读过 官方文档 相关内容,并尝试进行搜索。
  • [x] 尝试过在本地测试运行官方 demo 源码。
  • [x] 尝试过在 Codespace 中测试运行官方 demo 源码。

问题描述

Image Image markdown圆括号为什么会被错误解析呢,我网上查了圆括号并不是特殊用法吧

He1o avatar Jul 14 '25 11:07 He1o

Thanks for opening your first issue here! Be sure to follow the issue template!

welcome[bot] avatar Jul 14 '25 11:07 welcome[bot]

你可以先给出 markdown 源文件,而不是渲染结果,这样我才可以尝试复现问题。但在我的尝试中,没有遇到这种问题。测试 markdown 如下:

$1+1=2$(Yes!)

$1+1=2(Yes!)$(Hello?)

$1+1=2$(Yes! It is $math$)

Hello, Welcome to $Stellar$(a $great$ theme)

你好,欢迎使用$Stellar$(一个$very$ good的主题)

渲染结果可见于 Katex Test


现在,请检查一下配置文件,我主要想知道:

  1. 你用的数学渲染器是 Katex 还是 Mathjax?(在 _config.stellar.yml 中)
  2. 你用的 Markdown 渲染器是什么?(在 _config.ymlpackage.json 中)

rt265 avatar Jul 15 '25 06:07 rt265

你好,感谢回答,数学渲染器我是在_config.yml中配置的 mathjax: enable: true

package.json { "name": "hexo-site", "version": "0.0.0", "private": true, "scripts": { "build": "hexo generate", "clean": "hexo clean", "deploy": "hexo deploy", "server": "hexo server" }, "hexo": { "version": "7.3.0" }, "dependencies": { "hexo": "^7.3.0", "hexo-deployer-git": "^4.0.0", "hexo-generator-archive": "^2.0.0", "hexo-generator-category": "^2.0.0", "hexo-generator-feed": "^3.0.0", "hexo-generator-index": "^4.0.0", "hexo-generator-tag": "^2.0.0", "hexo-renderer-ejs": "^2.0.0", "hexo-renderer-kramed": "^0.1.4", "hexo-renderer-mathjax": "^0.6.0", "hexo-renderer-stylus": "^3.0.1", "hexo-server": "^3.0.0", "hexo-theme-landscape": "^1.0.0", "hexo-theme-redefine": "^2.8.2", "hexo-theme-stellar": "^1.33.0" } }

He1o avatar Jul 15 '25 12:07 He1o

~~根据我的排查,应该是 hexo-renderer-kramedhexo-renderer-mathjax 不兼容导致的。在我新建的测试博客中,同时安装它们两就会导致 () 被错误转译,但卸载 hexo-renderer-mathjax 后渲染就正常了(我没有卸载 hexo-renderer-kramed,因为我认为 renderer 是更核心的)~~

不要使用 hexo-renderer-mathjax!在我的测试中,仅单独使用 hexo-renderer-marked(在 Stellar 配置文件中开启 Mathjax)都不会出现圆括号的转译错误!

hexo-renderer-kramed 其实已经自带有限的 Mathjax 支持,完整支持需要在主题配置文件中注入 <script>(这一点你可以去看 renderer 文档),但不需要 hexo-renderer-mathjax

另外,最好在 _config.stellar.yml 而不是 _config.yml 中配置 Mathjax,因为 Stellar 是有原生 Mathjax 支持的。

rt265 avatar Jul 15 '25 13:07 rt265