From f51bf788269e9c5de3cd046b9b7a7f34e367bcf9 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Sun, 21 Jan 2024 19:56:04 +0800 Subject: [PATCH] [opt] global parser --- _config.yml | 6 +++--- layout/_partial/plugins/parser/head.ejs | 2 +- layout/_partial/plugins/parser/script.ejs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_config.yml b/_config.yml index 24aa789..5c58789 100755 --- a/_config.yml +++ b/_config.yml @@ -420,7 +420,7 @@ plugins: # 需在Markdown文件开头加入mathjax: true # 推荐使用Pandoc: npm uninstall hexo-renderer-marked --save & npm install hexo-renderer-pandoc --save mathjax: - # set to enable in page's front-matter + enable: # true # 可以在特定文章的 front-matter 中设置 mathjax: true 来开启,也可以在这里设置全局开启 js: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS-MML_HTMLorMML # Katex - The fastest math typesetting library for the web @@ -428,7 +428,7 @@ plugins: # https://github.com/KaTeX/KaTeX # 使用 hexo-renderer-markdown-it-plus 作为公式渲染器:npm uninstall hexo-renderer-marked --save npm install hexo-renderer-markdown-it-plus --save katex: - # set to enable in page's front-matter + enable: # true # 可以在特定文章的 front-matter 中设置 katex: true 来开启,也可以在这里设置全局开启 min_css: min_js: auto_render_min_js: @@ -443,7 +443,7 @@ plugins: # B -->|option 2| C(Section C) # ``` mermaid: - # set to enable in page's front-matter + enable: # true # 可以在特定文章的 front-matter 中设置 mermaid: true 来开启,也可以在这里设置全局开启 style_optimization: false # use custom style in stellar # js: https://unpkg.com/mermaid@9.0.0/dist/mermaid.min.js js: https://cdn.jsdelivr.net/npm/mermaid@v9/dist/mermaid.min.js diff --git a/layout/_partial/plugins/parser/head.ejs b/layout/_partial/plugins/parser/head.ejs index 77aca89..667c838 100644 --- a/layout/_partial/plugins/parser/head.ejs +++ b/layout/_partial/plugins/parser/head.ejs @@ -1,3 +1,3 @@ -<% if (page.katex == true) { %> +<% if (page.katex == true || theme.plugins.katex.enable == true) { %> <%- partial('katex/head') %> <% } %> \ No newline at end of file diff --git a/layout/_partial/plugins/parser/script.ejs b/layout/_partial/plugins/parser/script.ejs index b30bf39..3f112d5 100644 --- a/layout/_partial/plugins/parser/script.ejs +++ b/layout/_partial/plugins/parser/script.ejs @@ -1,9 +1,9 @@ -<% if (page.katex == true) { %> +<% if (page.katex == true || theme.plugins.katex.enable) { %> <%- partial('katex/script') %> <% } %> -<% if (page.mathjax == true) { %> +<% if (page.mathjax == true || theme.plugins.mathjax.enable) { %> <%- partial('mathjax/script') %> <% } %> -<% if (page.mermaid == true) { %> +<% if (page.mermaid == true || theme.plugins.mermaid.enable) { %> <%- partial('mermaid/script') %> <% } %> \ No newline at end of file