Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mathjax2 not rendering until page refresh #167

Closed
3 tasks done
silencial opened this issue Dec 27, 2020 · 12 comments
Closed
3 tasks done

Mathjax2 not rendering until page refresh #167

silencial opened this issue Dec 27, 2020 · 12 comments
Labels

Comments

@silencial
Copy link

Issue Checklist


Expected behavior

Math Equations should be rendered.

Actual behavior

Equations are not rendered when

  • click the Read More button to open a post

Equations are rendered when

  • open the post by clicking the Read More button and then refresh the page
  • open the post by using its link directly
  • switch to mathjax3

  • Links to demo site with this issue:

Go to this blog and open the post with title Mobile Robots on the first page. See that the math is not rendered, then refresh the page to see it works.

  • Links to repository or source code of the blog:
  • Screenshots:

Steps to reproduce the behavior

Environment Information

Node.js and NPM Information

v12.19.0
6.14.8

Package dependencies Information

[email protected] /Users/silencial/Documents/Blog
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Hexo Configuration

NexT Configuration

math:
  every_page: true

  mathjax:
    enable: true

  katex:
    enable: false
    copy_tex: false

vendors:
  mathjax: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=TeX-MML-AM_CHTML

Other Information

@silencial silencial added the Bug Something isn't working label Dec 27, 2020
@welcome
Copy link

welcome bot commented Dec 27, 2020

Thanks for opening this issue, maintainers will get back to you as soon as possible!

@sli1989
Copy link

sli1989 commented Dec 28, 2020

你的demo刷新也无法打开额。

@silencial
Copy link
Author

你的demo刷新也无法打开额。

我这边刷新数学公式就出来了呀 😂 你是开的哪一篇文章?

@stevenjoezhang
Copy link
Member

NexT only supports MathJax 3. You should update the CDN URL in vendors.

https://github.com/theme-next/hexo-theme-next/pull/1314/files#diff-ecec67b0e1d7e17a83587c6d27b6baaaa133f42482b07bd3685c77f34b62d883L912-R912

See also #4
截屏2020-12-28 上午11 10 53

@silencial
Copy link
Author

抱歉之前确实没找到这个说明。

使用 Mathjax3 是没问题的,但是 Mathjax3 目前还缺少很多 feature,比如 \\ 换行,可以参照 issue。估计很多人还是在使用 Mathjax2?

所以有没有可能继续支持 Mathjax2 呢?

@stevenjoezhang
Copy link
Member

如果要使用 Mathjax 2,最简单的方法是使用后端渲染插件 hexo-filter-mathjax,见 next-theme/hexo-filter-mathjax#15 (comment)

@silencial
Copy link
Author

安装 hexo-filter-mathjax 后和之前行为一样,还是需要刷新后公式才能正常渲染。直接从主页的 Read More 点进去公式不渲染

@stevenjoezhang
Copy link
Member

stevenjoezhang commented Dec 28, 2020

执行 hexo clean 试试

另外需要禁用 NexT 自带的 MathJax

math:
  mathjax:
    enable: false

@silencial
Copy link
Author

试了一圈,发现在文章 front-matter 中加入 mathjax: true 后一切正常,否则即使刷新也没有效果。不知道要怎么开启对所有页面都默认支持 mathjax 的选项呢?

已在 hexo 的 _config.yml 中开启,但无效:

mathjax:
  every_page: true

@silencial
Copy link
Author

大概明白了,[email protected] 版还不支持 every_page 的选项。看来只能在每篇 post 中加入 mathjax: true

@silencial
Copy link
Author

问题还是有点多,比如 numbering equations 也不行了,看来还是得等 MathJax3 支持 😐。
感谢 @stevenjoezhang

@github-actions
Copy link

github-actions bot commented Sep 4, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants