diff options
author | joyqat <joyqat@users.noreply.github.com> | 2020-07-23 09:55:44 +0300 |
---|---|---|
committer | joyqat <joyqat@users.noreply.github.com> | 2020-07-23 09:55:44 +0300 |
commit | 91cf4b6be565e145ee0f15c2412f7737176d41bd (patch) | |
tree | a183d89b99cb1e73b55949b7f9897981a5323a86 | |
parent | 7b49b382f1916d0d6c9ea9ec0b7dbddcbb12311b (diff) |
Mathjax v3
--------
1. update to mathjax 3
2. add scroll to long formula
-rw-r--r-- | assets/sass/components/_math.scss | 13 | ||||
-rw-r--r-- | data/lib.toml | 2 | ||||
-rw-r--r-- | layouts/partials/script/single-script.html | 44 |
3 files changed, 20 insertions, 39 deletions
diff --git a/assets/sass/components/_math.scss b/assets/sass/components/_math.scss index 740c6e3..d6e7579 100644 --- a/assets/sass/components/_math.scss +++ b/assets/sass/components/_math.scss @@ -1,11 +1,4 @@ -code.has-jax { - font: inherit; - font-size: 100%; - background: inherit; - border: inherit; - color: #515151; -} - .MathJax { - font-size: 120% !important; -}
\ No newline at end of file + overflow-x: auto; + overflow-y: hidden; +} diff --git a/data/lib.toml b/data/lib.toml index f31f134..cc1aa0f 100644 --- a/data/lib.toml +++ b/data/lib.toml @@ -20,7 +20,7 @@ url = "https://cdn.jsdelivr.net/npm/raphael@2.3.0/raphael.min.js" [js.mathjax] - url = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js" + url = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" [js.webfont] sri = "" # no sri diff --git a/layouts/partials/script/single-script.html b/layouts/partials/script/single-script.html index e3542a6..2832470 100644 --- a/layouts/partials/script/single-script.html +++ b/layouts/partials/script/single-script.html @@ -30,35 +30,23 @@ {{ end }} {{ if in .Params.Libraries "mathjax" }} - <script type="text/javascript" async src="{{ $js.mathjax.url }}?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'; - } - }); - - MathJax.Hub.Config({ - // Autonumbering by mathjax - TeX: { equationNumbers: { autoNumber: "AMS" } } - }); +<script> + window.MathJax = { + tex: { + inlineMath: [['$', '$']], + displayMath: [['$$', '$$']], + processEscapes: true, + processEnvironments: true, + tags: "ams" + }, + options: { + skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre'], + ignoreHtmlClass: 'tex2jax_ignore', + processHtmlClass: 'tex2jax_process' + } + }; </script> + <script async src="{{ $js.mathjax.url }}"></script> {{ end }} {{ if in .Params.Libraries "msc" }} |