hexo-theme-yinwang icon indicating copy to clipboard operation
hexo-theme-yinwang copied to clipboard

如何支持公式块

Open toleleYJL opened this issue 1 year ago • 5 comments

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

toleleYJL avatar Mar 14 '23 06:03 toleleYJL

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

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

smallyunet avatar Mar 14 '23 07:03 smallyunet

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

toleleYJL avatar Mar 14 '23 08:03 toleleYJL

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

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

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

smallyunet avatar Mar 14 '23 08:03 smallyunet

感谢,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

toleleYJL avatar Mar 18 '23 09:03 toleleYJL

感谢,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

toleleYJL avatar Mar 18 '23 09:03 toleleYJL