xaoxuu / hexo-theme-stellar

内置文档系统的简约商务风Hexo主题,支持大量的标签组件和动态数据组件。
https://xaoxuu.com/wiki/stellar/
MIT License
1.26k stars 313 forks source link

使用ketex公式重复渲染 #365

Closed utopeadia closed 7 months ago

utopeadia commented 7 months ago

例如在markdown中,公式表示为:

$$
E=\frac{a}{m}
$$

$$
精度=1 - 错误率
$$

实际显示为: 即在正常渲染外出现了额外公式 同时存在了mathml和html

xaoxuu commented 7 months ago

这里也有这个问题吗:

https://xaoxuu.com/wiki/stellar/third-party/katex.html

utopeadia commented 7 months ago

这里也有这个问题吗:

https://xaoxuu.com/wiki/stellar/third-party/katex.html

您的博客没有这个现象

utopeadia commented 7 months ago

这里也有这个问题吗:

https://xaoxuu.com/wiki/stellar/third-party/katex.html

我想大致找到问题了,如果在md中没有添加katex: true就会出现两次渲染。请问下这个可以调整为只在config中设置吗,文档改成默认为true,如果渲染有错手动false这样,因为早期文档很多,批量更改文档本身迁移性会降低

xaoxuu commented 7 months ago

全局开启是吗?

github-actions[bot] commented 7 months ago

:wave: Hello, Your suggestion is great, we will add this feature in subsequent versions, thank you very much!

:wave: 您好, 您的建议很棒,我们将会在后续版本中加入这个功能,非常感谢!

utopeadia commented 7 months ago

全局开启是吗?

config里面开启了ketex: true,如果md不开启ketex: true则会出现两个渲染,我这里可以复现,不清楚是因为配置的问题还是某个可能存在的模块?

```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.0.0"
  },
  "dependencies": {
    "hexo": "^7.0.0",
    "hexo-ai-excerpt": "^1.1.1",
    "hexo-auto-category": "^0.2.2",
    "hexo-baidu-url-submit": "^0.0.6",
    "hexo-deployer-git": "^4.0.0",
    "hexo-filter-mermaid-diagrams": "^1.0.5",
    "hexo-generator-archive": "^2.0.0",
    "hexo-generator-baidu-sitemap": "^0.1.9",
    "hexo-generator-category": "^2.0.0",
    "hexo-generator-index": "^3.0.0",
    "hexo-generator-search": "^2.4.3",
    "hexo-generator-sitemap": "^3.0.1",
    "hexo-generator-tag": "^2.0.0",
    "hexo-migrator-wordpress": "^2.1.2",
    "hexo-neat": "^1.0.9",
    "hexo-related-popular-posts": "^5.0.1",
    "hexo-renderer-ejs": "^2.0.0",
    "hexo-renderer-markdown-it-plus": "^1.0.6",
    "hexo-renderer-stylus": "^3.0.0",
    "hexo-server": "^3.0.0",
    "hexo-theme-landscape": "^1.0.0",
    "minimatch": "^9.0.3"
  }
}
xaoxuu commented 7 months ago

我看了下大概知道了,原本就是会出现两个标签,katex 的 css 文件里隐藏掉了一个,md 里如果设置 katex:true 则会引入这个 css ,所以看起来就不会重复了。

xaoxuu commented 7 months ago

我提交了代码,你更新一下看看: f51bf788269e9c5de3cd046b9b7a7f34e367bcf9 在 _config.stellar.yml 中增加来全局开启:

plugins:
  katex:
    enable: true
utopeadia commented 7 months ago

我提交了代码,你更新一下看看: f51bf78_config.stellar.yml 中增加来全局开启:

plugins:
  katex:
    enable: true

我尝试了新版本,很完美。

github-actions[bot] commented 7 months ago

:wave: Hello, This issue has been marked as resolved. If there are other issues, please contact us with a new issue.

:wave: 您好, 此 issue 已经被标记为已解决,如果还有其它问题,请提出新的 issue 联系我们。