feat: config mathjax to use $...$ for in-line math mode (#22)

* Update cdn mathjax version to 2.7.2
This commit is contained in:
Chun-Hung Tseng 2018-01-15 22:22:14 +08:00 committed by olOwOlo
parent e1f5be88d3
commit 6f7bd1b933
3 changed files with 9 additions and 4 deletions

View file

@ -18,6 +18,7 @@ autoCollapseToc: false
contentCopyright: false contentCopyright: false
reward: false reward: false
mathjax: false mathjax: false
mathjaxEnableSingleDollar: false
--- ---
<!--more--> <!--more-->

View file

@ -67,6 +67,7 @@ copyright = "" # default: author.name ↓ # 默认为下面配
fancybox = true # see https://github.com/fancyapps/fancybox # 是否启用fancybox图片可点击 fancybox = true # see https://github.com/fancyapps/fancybox # 是否启用fancybox图片可点击
bootcdn = false # In china. @Deprecated: use [params.publicCDN] # 是否使用bootcdn(@Deprecated: 请使用[params.publicCDN]) bootcdn = false # In china. @Deprecated: use [params.publicCDN] # 是否使用bootcdn(@Deprecated: 请使用[params.publicCDN])
mathjax = false # see https://www.mathjax.org/ # 是否使用mathjax数学公式 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文件 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>' contentCopyright = '<a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">CC BY-NC-ND 4.0</a>'

View file

@ -16,13 +16,16 @@
<script type="text/javascript" src="{{ "dist/even.min.js?v=2.7.2" | relURL }}"></script> <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) }} {{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }}
<script type="text/javascript"> <script type="text/x-mathjax-config">
window.MathJax = { MathJax.Hub.Config({
{{ if or .Params.mathjaxEnableSingleDollar (and .Site.Params.mathjaxEnableSingleDollar (ne .Params.mathjaxEnableSingleDollar false)) -}}
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]},
{{ end -}}
showProcessingMessages: false, showProcessingMessages: false,
messageStyle: 'none' messageStyle: 'none'
}; });
</script> </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 }} {{- end }}
<!-- Analytics --> <!-- Analytics -->