aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archetypes/default.md1
-rw-r--r--exampleSite/config.toml1
-rw-r--r--layouts/partials/scripts.html11
3 files changed, 9 insertions, 4 deletions
diff --git a/archetypes/default.md b/archetypes/default.md
index dd9dc12..5a49b9e 100644
--- a/archetypes/default.md
+++ b/archetypes/default.md
@@ -18,6 +18,7 @@ autoCollapseToc: false
contentCopyright: false
reward: false
mathjax: false
+mathjaxEnableSingleDollar: false
---
<!--more-->
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index e2ed85c..bfb229c 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -67,6 +67,7 @@ copyright = "" # default: author.name ↓ # 默认为下面配
fancybox = true # see https://github.com/fancyapps/fancybox # 是否启用fancybox(图片可点击)
bootcdn = false # In china. @Deprecated: use [params.publicCDN] # 是否使用bootcdn(@Deprecated: 请使用[params.publicCDN])
mathjax = false # see https://www.mathjax.org/ # 是否使用mathjax(数学公式)
+ mathjaxEnableSingleDollar = false # 是否使用 $...$ 即可進行inline latex渲染
linkToMarkDown = false # if you config contentCopyright and hugo output .md files. # 是否在链接到markdown原始文件(如果你配置了下面的许可协议并允许hugo生成markdown文件)
contentCopyright = '<a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">CC BY-NC-ND 4.0</a>'
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 1a284ee..2cfa68a 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -16,13 +16,16 @@
<script type="text/javascript" src="{{ "dist/even.min.js?v=2.7.2" | relURL }}"></script>
{{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
- <script type="text/javascript">
- window.MathJax = {
+ <script type="text/x-mathjax-config">
+ MathJax.Hub.Config({
+ {{ if or .Params.mathjaxEnableSingleDollar (and .Site.Params.mathjaxEnableSingleDollar (ne .Params.mathjaxEnableSingleDollar false)) -}}
+ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
+ {{ end -}}
showProcessingMessages: false,
messageStyle: 'none'
- };
+ });
</script>
- <script async src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML'></script>
+ <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script>
{{- end }}
<!-- Analytics -->