From e2b3b8901ed0e31d537367b3b7221bd28621be2c Mon Sep 17 00:00:00 2001 From: Heyya <54407642+Heyya-x@users.noreply.github.com> Date: Wed, 1 Jun 2022 16:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8Mathjax=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AF=B9=E6=95=B0=E5=AD=A6=E5=85=AC=E5=BC=8F=E7=9A=84=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20(#88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 新增数学公式配置选项 * add * add mathjax.ejs * Update _config.yml * Update mathjax.ejs Co-authored-by: xaoxuu <16400144+xaoxuu@users.noreply.github.com> --- _config.yml | 8 +++++++- layout/mathjax.ejs | 29 +++++++++++++++++++++++++++++ layout/post.ejs | 3 +++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 layout/mathjax.ejs diff --git a/_config.yml b/_config.yml index 3fac7d6..b2ec401 100755 --- a/_config.yml +++ b/_config.yml @@ -84,7 +84,6 @@ article: auto_cover: true # 如果没有封面就根据 tags 作为关键词搜索封面,开了此项将不会自动从文章中提取首张图片作为封面了。 - ######## Comments ######## comments: service: # beaudar, utterances, valine, twikoo, waline @@ -303,6 +302,13 @@ plugins: enable: false css: https://unpkg.com/heti/umd/heti.min.css js: https://unpkg.com/heti/umd/heti-addon.min.js + + # MathJax + # 需在Markdown文件开头加入mathjax: true + # 推荐使用Pandoc: npm uninstall hexo-renderer-marked --save & npm install hexo-renderer-pandoc --save + mathjax: + enable: false + cdn: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS-MML_HTMLorMML style: diff --git a/layout/mathjax.ejs b/layout/mathjax.ejs new file mode 100755 index 0000000..1c3af32 --- /dev/null +++ b/layout/mathjax.ejs @@ -0,0 +1,29 @@ +<% if (theme.plugins.mathjax.enable){ %> + + + + + + + +<% } %> diff --git a/layout/post.ejs b/layout/post.ejs index 43c5270..9f9711c 100755 --- a/layout/post.ejs +++ b/layout/post.ejs @@ -19,6 +19,9 @@ if (theme.plugins.heti && theme.plugins.heti.enable) { heti = ' heti'; } %> +<% if (page.mathjax == true){ %> + <%- partial('mathjax') %> +<% } %> <%- partial('_partial/main/navbar/breadcrumb') %>
<%- scrollreveal() %>'> <%- layoutTitle() %>