diff options
author | monkeyWzr <monkeywzr@gmail.com> | 2020-07-24 11:40:05 +0300 |
---|---|---|
committer | monkeyWzr <monkeywzr@gmail.com> | 2020-07-24 11:40:05 +0300 |
commit | 0d3f08d357545a25bca8bbcdfbddfc41835e35b1 (patch) | |
tree | 4e8b503c1042be2d66f63717ac95715cad614d85 /layouts/posts | |
parent | 8b9e083afcd3285561a16ffe1d5e1b4572dfe29e (diff) |
add mathjax support
Diffstat (limited to 'layouts/posts')
-rw-r--r-- | layouts/posts/single.html | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/layouts/posts/single.html b/layouts/posts/single.html index b236e46..dab8de5 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -77,4 +77,25 @@ <link rel="stylesheet" href="/lib/font-awesome/css/all.min.css"> <script src="/lib/jquery/jquery.min.js"></script> <script src="/js/main.js"></script> +{{ $mathjax := false }} +{{ if isset .Params "mathjax" }} + {{ $mathjax = .Params.mathjax }} +{{ else if isset .Site.Params "mathjax" }} + {{ $mathjax = .Site.Params.mathjax }} +{{ end }} +{{ if $mathjax }} +<script> + MathJax = { + tex: { + inlineMath: [['$', '$'], ['\\(', '\\)']] + }, + svg: { + fontCache: 'global' + } + }; +</script> +<script type="text/javascript" id="MathJax-script" async + src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"> +</script> +{{ end }} </html> |