fi3ework / hexo-theme-archer

🎯 A smart and modern theme for Hexo.
https://fi3ework.github.io/hexo-theme-archer
MIT License
1.5k stars 274 forks source link

Add Mathjax to support LaTeX math formula #268

Closed vsxd closed 2 years ago

vsxd commented 4 years ago

According to 给Hexo主题添加LaTeX公式支持, I added mathjax.ejs, modified post.ejs and appended configurations to _config.yml. I also added some brief instructions to README.

LolipopJ commented 3 years ago

~Hexo 博客预设的 hexo-renderer-marked 是官方活跃维护的渲染 md 文档的仓库,但对 LaTeX 渲染支持不全。~

~很多技术博客都提到了 NexT 主题推荐使用 hexo-renderer-kramed 渲染 LaTeX。但实际上,现在 NexT 主题推荐使用另一个 md 渲染库 hexo-renderer-pandoc。~

~If you use MathJax to render Math Equations, you need to use one of them: hexo-renderer-pandoc or hexo-renderer-kramed (Not recommended) as the renderer for Markdown.~

~因此,或许可以考虑将依赖中的 hexo-renderer-kramed 库换成更推荐的 hexo-renderer-pandoc 库。~


~看了下源码,hexo-renderer-pandoc 库没有任何依赖,直接作为拓展注入到 Hexo 中。~

~如果能实现相同的功能,hexo-renderer-pandoc 确实是更优先的选择。~


嗨,我研究了一下 LaTeX 数学公式渲染的问题,正如这篇 Wiki 所说:

事实上启用对 Latex 的支持是 Hexo 的一项功能,而与 archer 无关。

如果博客主题的用户需要,可以参考相关的技术博客手动配置 MathJax 支持。理由有如下几条:

以上是我的一家之见,从我的角度来说,我可能将拒绝合并这个 PR。作为支持 LaTeX 数学公式的实现,我更倾向于将它作为一篇 Wiki 供人查阅。

或者,您也许会有一些其它的看法,欢迎提出来一起探讨!

LolipopJ commented 2 years ago

Hi,我又又重新研究了一下引入 MathJax 作为 LaTeX 数学公式的问题,考虑到 hexo-math 渲染出来的结果是一张 SVG 图片,而只有引入 MathJax 库并进行适配,才能获得完整的数学公式支持。

因此我将您的 PR 合并到了 dev-1.6.3 分支上,并更新了相应的文档和 Wiki 内容。

再一次,感谢您的贡献!❤️