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

如何支持公式块 #17

Open
toleleYJL opened this issue Mar 14, 2023 · 5 comments
Open

如何支持公式块 #17

toleleYJL opened this issue Mar 14, 2023 · 5 comments

Comments

@toleleYJL
Copy link

你好,请问如何让这个主题支持公式块呢?就像makedown格式的那样。

@smallyunet
Copy link
Owner

smallyunet commented Mar 14, 2023

刚才更新了一下,试一下好用吗?

$$V_{sphere} = \frac{4}{3}\pi r^3$$

@toleleYJL
Copy link
Author

行间公式块可以很好地转换了,不知道能不能使行内公式块也同样支持呢?
image

@smallyunet
Copy link
Owner

我把主题恢复到之前的代码了,关于 Latex 的支持,你可以用一下这个 hexo 插件:

https://github.com/next-theme/hexo-filter-mathjax

按照里面的步骤安装使用就好了,我试了一下是好用的。

@toleleYJL
Copy link
Author

感谢,mathjax我配置了后发现还是不行的,不过最后通过分析其它主题的代码找到了解决方法。我对/layout/layout.pug文件进行了修改,最终是这样子的:

if theme.mathjax.enable
    script(src="https://polyfill.io/v3/polyfill.min.js?features=es6")
    script(async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js")
    script.
      MathJax = {
            tex: {
                inlineMath: [['$', '$'], ['\\(', '\\)']]
            },
            svg: {
                fontCache: 'global'
            }
        };

image

1 similar comment
@toleleYJL
Copy link
Author

感谢,mathjax我配置了后发现还是不行的,不过最后通过分析其它主题的代码找到了解决方法。我对/layout/layout.pug文件进行了修改,最终是这样子的:

if theme.mathjax.enable
    script(src="https://polyfill.io/v3/polyfill.min.js?features=es6")
    script(async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js")
    script.
      MathJax = {
            tex: {
                inlineMath: [['$', '$'], ['\\(', '\\)']]
            },
            svg: {
                fontCache: 'global'
            }
        };

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants