From c20128d48168b8f5c9be04bd9a0e3229ee73c121 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Tue, 25 Aug 2020 15:44:03 +0200 Subject: [PATCH] Fix #416 - update to MathJax 3 --- docs/mathjax.config.js | 12 ++++++++++++ mkdocs-en.yml | 5 ++++- mkdocs-fr.yml | 5 ++++- package-lock.json | 6 +++--- package.json | 2 +- scripts/mkdocs-postprocess.js | 9 ++++----- 6 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 docs/mathjax.config.js diff --git a/docs/mathjax.config.js b/docs/mathjax.config.js new file mode 100644 index 000000000..14555b581 --- /dev/null +++ b/docs/mathjax.config.js @@ -0,0 +1,12 @@ +window.MathJax = { + tex: { + inlineMath: [["\\(", "\\)"]], + displayMath: [["\\[", "\\]"]], + processEscapes: true, + processEnvironments: true + }, + options: { + ignoreHtmlClass: ".*|", + processHtmlClass: "arithmatex" + } +}; \ No newline at end of file diff --git a/mkdocs-en.yml b/mkdocs-en.yml index 5cad58607..0278e599d 100644 --- a/mkdocs-en.yml +++ b/mkdocs-en.yml @@ -10,12 +10,15 @@ theme: language: 'en' use_directory_urls: false extra_javascript: - - ../javascripts/mathjax/MathJax.js?config=TeX-AMS_CHTML + - ../javascripts/mathjax.config.js + - ../javascripts/mathjax/tex-mml-chtml.js - ../javascripts/matomo-tracking.js markdown_extensions: - mdx_math - footnotes - codehilite + - pymdownx.arithmatex: + generic: true nav: - Presentation of Cassiopée: - index.md diff --git a/mkdocs-fr.yml b/mkdocs-fr.yml index f7ac501cd..6b0870d90 100644 --- a/mkdocs-fr.yml +++ b/mkdocs-fr.yml @@ -10,12 +10,15 @@ theme: language: 'fr' use_directory_urls: false extra_javascript: - - ../javascripts/mathjax/MathJax.js?config=TeX-AMS_CHTML + - ../javascripts/mathjax.config.js + - ../javascripts/mathjax/tex-mml-chtml.js - ../javascripts/matomo-tracking.js markdown_extensions: - mdx_math - footnotes - codehilite + - pymdownx.arithmatex: + generic: true nav: - Présentation de Cassiopée: - index.md diff --git a/package-lock.json b/package-lock.json index 07c9e6b81..16fb374d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13146,9 +13146,9 @@ "integrity": "sha1-mnHEh0chjrylHlGmbaaCA4zct78=" }, "mathjax": { - "version": "2.7.8", - "resolved": "https://registry.npmjs.org/mathjax/-/mathjax-2.7.8.tgz", - "integrity": "sha512-n4xZJ+cw7o01YOSVhxxjyOmibqBPCi+XTDof4siq78QWMx7Fxjzgb/mxMUEElMzTDodMV7ENIMsjREOSldOQPw==" + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/mathjax/-/mathjax-3.0.5.tgz", + "integrity": "sha512-9M7VulhltkD8sIebWutK/VfAD+m+6BIFqfpjDh9Pz/etoKUtjO6UMnOhUcDmNl6iApE8C9xrUmaMyNZkZAlrMw==" }, "md5-file": { "version": "5.0.0", diff --git a/package.json b/package.json index efc799d43..465906635 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "he": "^1.2.0", "jalhyd": "file:../jalhyd", "material-design-icons": "^3.0.1", - "mathjax": "^2.7.8", + "mathjax": "^3.0.5", "mermaid": "^8.7.0", "ngx-konami": "^1.7.1", "ngx-markdown": "^10.1.1", diff --git a/scripts/mkdocs-postprocess.js b/scripts/mkdocs-postprocess.js index fcb2b04eb..5e4cc9e6f 100644 --- a/scripts/mkdocs-postprocess.js +++ b/scripts/mkdocs-postprocess.js @@ -16,10 +16,9 @@ fs.emptyDirSync(destPath); fs.ensureDirSync(destPathMJ + "/fonts/HTML-CSS/TeX/", { recursive: true }); // copy required files only -fs.copySync("node_modules/mathjax/MathJax.js", destPathMJ + "/MathJax.js"); -fs.copySync("node_modules/mathjax/config", destPathMJ + "/config"); -fs.copySync("node_modules/mathjax/jax", destPathMJ + "/jax"); -fs.copySync("node_modules/mathjax/fonts/HTML-CSS/TeX/woff", destPathMJ + "/fonts/HTML-CSS/TeX/woff"); -fs.copySync("node_modules/mathjax/fonts/HTML-CSS/TeX/otf", destPathMJ + "/fonts/HTML-CSS/TeX/otf"); +fs.copySync("node_modules/mathjax/es5/tex-mml-chtml.js", destPathMJ + "/tex-mml-chtml.js"); +fs.copySync("node_modules/mathjax/es5/output/chtml/fonts", destPathMJ + "/output/chtml/fonts"); + +fs.copySync("docs/mathjax.config.js", destPath + "/mathjax.config.js"); fs.copySync("docs/matomo-tracking.js", destPath + "/matomo-tracking.js"); -- GitLab