From 9ee2605a49a57f98757a3670d05ab0d09e6c2c22 Mon Sep 17 00:00:00 2001 From: shenyu <448766534@qq.com> Date: Mon, 30 Mar 2020 20:27:17 +0800 Subject: [PATCH] :sparkles: feat: Katex support --- README.md | 8 +++++++- _config.yml | 8 +++++++- layout/_partial/after-footer.ejs | 5 ++++- layout/_partial/katex.ejs | 11 +++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 layout/_partial/katex.ejs diff --git a/README.md b/README.md index 7ed92bd..6ff024a 100644 --- a/README.md +++ b/README.md @@ -207,9 +207,15 @@ google_analytics: '' # Baidu Analytics baidu_analytics: '' -# mathjax +# Mathjax Support mathjax: true +# Katex Support +katex: + enable: false # true + allpost: true + copy_tex: false + # since year since: 2019 diff --git a/_config.yml b/_config.yml index abccac4..e2e0ff0 100644 --- a/_config.yml +++ b/_config.yml @@ -153,9 +153,15 @@ google_analytics: '' # 百度统计 baidu_analytics: '' -# 数学公式 +# Mathjax数学公式 mathjax: false +# Katex数学公式(allpost设置为false时只有头部设置math:true的文章才开启) +katex: + enable: false # true + allpost: true + copy_tex: false + # 网站成立年份(默认为 2019,若填入年份小于当前年份,则显示为 2018-2019 类似的格式) since: 2015 diff --git a/layout/_partial/after-footer.ejs b/layout/_partial/after-footer.ejs index 67a2dd6..717e697 100644 --- a/layout/_partial/after-footer.ejs +++ b/layout/_partial/after-footer.ejs @@ -52,11 +52,14 @@ } <% } %> +<% if (theme.katex.enable){ %> +<%- partial('katex') %> +<% } %> <% if (theme.busuanzi && theme.busuanzi.enable){ %> <%- js('/js/busuanzi-2.3.pure.min') %> <% } %> <% if (theme.clickLove){ %> - + <%- js('/js/clickLove') %> <% } %> \ No newline at end of file diff --git a/layout/_partial/katex.ejs b/layout/_partial/katex.ejs new file mode 100644 index 0000000..d6a7774 --- /dev/null +++ b/layout/_partial/katex.ejs @@ -0,0 +1,11 @@ +<% if ( theme.katex.enable ) { %> + <% if( theme.katex.allpost || page.math ) { %> + + + + <% if ( theme.katex.copy_tex ) { %> + + + <% } %> + <% } %> +<% } %> \ No newline at end of file