next-theme / hexo-theme-next

🎉 Elegant and powerful theme for Hexo.
https://theme-next.js.org
Other
2.41k stars 426 forks source link

开启pjax时mathjax会不渲染(MathJax.typeset不加载mhchem) #355

Closed woruo27 closed 3 years ago

woruo27 commented 3 years ago

Please follow this Issue template to provide relevant information, such as source code repository, website URL and screenshots, which will help us investigate. 请按照此 Issue 模版提供相关信息,例如源码仓库、网站链接和屏幕截图,这将有助于我们进行调查。

Issue Checklist


Expected behavior

mathjax正常渲染

Actual behavior

image

公式会以markdown中的源代码显示。

我想应该对mathjax进行特殊处理,绕过pjax让其在页面切换时重新渲染一次。

测试环境无法提供公网访问,生产环境已经关闭pjax。

Steps to reproduce the behavior

建一个新站,配置好next,打开pjax和mathjax。新建一个post,把公式放进<!-- more -->下面。部署好以后从主页点击链接进入post,可以观察到mathjax并未渲染。

Environment Information

Node.js and NPM Information

v14.17.5
cnpm@7.0.0 (/usr/local/lib/node_modules/cnpm/lib/parse_argv.js)
npm@6.14.14 (/usr/local/lib/node_modules/cnpm/node_modules/_npm@6.14.14@npm/lib/npm.js)
node@14.17.5 (/usr/local/bin/node)
npminstall@5.0.2 (/usr/local/lib/node_modules/cnpm/node_modules/_npminstall@5.0.2@npminstall/lib/index.js)
prefix=/usr/local 
linux x64 5.4.0-80-generic 
registry=https://registry.nlark.com

Package dependencies Information

hexo-site@0.0.0 /home/woruo/web/test
├── hexo-theme-next@8.7.0 extraneous
├── hexo@5.4.0
├── hexo-generator-archive@1.0.0
├── hexo-generator-category@1.0.0
├── hexo-generator-index@2.0.0
├── hexo-generator-tag@1.0.0
├── hexo-renderer-ejs@1.0.0
├── hexo-renderer-marked@4.1.0
├── hexo-renderer-stylus@2.0.1
├── hexo-server@2.0.0
├── hexo-theme-landscape@0.0.3
└── hexo-theme-next@8.7.0

Hexo Configuration

theme: next

NexT Configuration

pjax: true

math:
  every_page: true

  mathjax:
    enable: true

Other Information

CHROME VERSION    92.0.4515.159
OS VERSION    Windows NT: 10.0.19042
stevenjoezhang commented 3 years ago

我无法复现你所说的这个问题,请问你能否新建一个测试网站部署出来?

mathjax的特殊处理已经做了,不应当出现这个问题 https://github.com/next-theme/hexo-theme-next/blob/361c7e16c624a3c0c32f2c9b57a2a13e5746a3c3/source/js/third-party/math/mathjax.js#L31-L34

ljcbaby commented 3 years ago

@zj713300 我也尝试了,无法复现

woruo27 commented 3 years ago

用这个复现:https://github.com/zj713300/test 部署:test.woruo.online

stevenjoezhang commented 3 years ago

原因是mhchem没动态加载 见 https://github.com/mathjax/MathJax/issues/2557#issuecomment-727655089 现在应该修复了 https://github.com/next-theme/hexo-theme-next/commit/7b8cf30732ae13e330bbdee93f17a8f5e3d436b2

stevenjoezhang commented 3 years ago

这个Issue我先关了,如果mathjax还有别的问题可以回复一下

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. It is possible issue was solved or at least outdated. Feel free to open new for related bugs.