diff options
author | imzeuk <imzeuk@gmail.com> | 2019-04-16 10:04:06 +0300 |
---|---|---|
committer | imzeuk <imzeuk@gmail.com> | 2019-04-16 10:04:06 +0300 |
commit | cb991e36fd582bb1bcc8ee58621d2feaae409866 (patch) | |
tree | f1cd9cd5e7896d4081e5622a7a7355caec7c9ddf /layouts | |
parent | 009ecf34d8fd294986cc8898211a849c74d06021 (diff) |
add MathJax
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/js.html | 4 | ||||
-rw-r--r-- | layouts/partials/mathjax.html | 33 |
2 files changed, 37 insertions, 0 deletions
diff --git a/layouts/partials/js.html b/layouts/partials/js.html index 46225b5..283efdb 100644 --- a/layouts/partials/js.html +++ b/layouts/partials/js.html @@ -5,3 +5,7 @@ <script src="{{ "/js/fancybox.min.js" | relURL }}"></script> <script>hljs.initHighlightingOnLoad()</script> + +{{ if .Site.Params.mathjax }} + {{ partial "mathjax.html" . }} +{{ end }} diff --git a/layouts/partials/mathjax.html b/layouts/partials/mathjax.html new file mode 100644 index 0000000..a8c59ab --- /dev/null +++ b/layouts/partials/mathjax.html @@ -0,0 +1,33 @@ +<script type="text/javascript" async src="https://cdn.bootcss.com/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> +MathJax.Hub.Config({ + tex2jax: { + inlineMath: [['$','$'], ['\\(','\\)']], + displayMath: [['$$','$$'], ['\[\[','\]\]']], + processEscapes: true, + processEnvironments: true, + skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'], + TeX: { equationNumbers: { autoNumber: "AMS" }, + extensions: ["AMSmath.js", "AMSsymbols.js"] } + } +}); + +MathJax.Hub.Queue(function() { + // Fix <code> tags after MathJax finishes running. This is a + // hack to overcome a shortcoming of Markdown. Discussion at + // https://github.com/mojombo/jekyll/issues/199 + var all = MathJax.Hub.getAllJax(), i; + for(i = 0; i < all.length; i += 1) { + all[i].SourceElement().parentNode.className += ' has-jax'; + } +}); +</script> + +<style> +code.has-jax { + font: inherit; + font-size: 100%; + background: inherit; + border: inherit; + color: #515151; +} +</style>
\ No newline at end of file |