From 91cf4b6be565e145ee0f15c2412f7737176d41bd Mon Sep 17 00:00:00 2001 From: joyqat Date: Thu, 23 Jul 2020 14:55:44 +0800 Subject: [PATCH 1/3] Mathjax v3 -------- 1. update to mathjax 3 2. add scroll to long formula --- assets/sass/components/_math.scss | 13 ++----- data/lib.toml | 2 +- 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" }} - + {{ end }} {{ if in .Params.Libraries "msc" }} From 4069de6423777a4d753fd16361897fccd0cabcc2 Mon Sep 17 00:00:00 2001 From: joyqat Date: Fri, 24 Jul 2020 10:09:48 +0800 Subject: [PATCH 2/3] Mathjax: 1. prevent clip due to x scroll 2. (IE support)add polyfill.js advised from mathjax --- assets/sass/components/_math.scss | 1 + layouts/partials/script/single-script.html | 1 + 2 files changed, 2 insertions(+) diff --git a/assets/sass/components/_math.scss b/assets/sass/components/_math.scss index d6e7579..2a66e4d 100644 --- a/assets/sass/components/_math.scss +++ b/assets/sass/components/_math.scss @@ -1,4 +1,5 @@ .MathJax { overflow-x: auto; overflow-y: hidden; + box-sizing: border-box; } diff --git a/layouts/partials/script/single-script.html b/layouts/partials/script/single-script.html index 2832470..3e39f69 100644 --- a/layouts/partials/script/single-script.html +++ b/layouts/partials/script/single-script.html @@ -46,6 +46,7 @@ } }; + {{ end }} From 960b108852d1d3a3c21b6b3a162f99ac72eb3a04 Mon Sep 17 00:00:00 2001 From: joyqat Date: Fri, 24 Jul 2020 10:54:27 +0800 Subject: [PATCH 3/3] Mathjax: Fix clip due to font size --- layouts/partials/script/single-script.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/layouts/partials/script/single-script.html b/layouts/partials/script/single-script.html index 3e39f69..edca548 100644 --- a/layouts/partials/script/single-script.html +++ b/layouts/partials/script/single-script.html @@ -39,6 +39,9 @@ processEnvironments: true, tags: "ams" }, + chtml: { + scale: 1.1 + }, options: { skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre'], ignoreHtmlClass: 'tex2jax_ignore',