diff --git a/ecc/static/tex.js b/ecc/static/tex.js index 2c5c72f..080801e 100644 --- a/ecc/static/tex.js +++ b/ecc/static/tex.js @@ -1,23 +1,16 @@ window.MathJax = { + tex: { + inlineMath: [["\\(", "\\)"]], + displayMath: [["\\[", "\\]"]], + processEscapes: true, + processEnvironments: true + }, options: { - ignoreHtmlClass: 'tex2jax_ignore', - processHtmlClass: 'tex2jax_process', - renderActions: { - find: [10, function (doc) { - for (const node of document.querySelectorAll('script[type^="math/tex"]')) { - const display = !!node.type.match(/; *mode=display/); - const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display); - const text = document.createTextNode(''); - const sibling = node.previousElementSibling; - node.parentNode.replaceChild(text, node); - math.start = {node: text, delim: '', n: 0}; - math.end = {node: text, delim: '', n: 0}; - doc.math.push(math); - if (sibling && sibling.matches('.MathJax_Preview')) { - sibling.parentNode.removeChild(sibling); - } - } - }, ''] - } + ignoreHtmlClass: ".*|", + processHtmlClass: "arithmatex" } }; + +document$.subscribe(() => { + MathJax.typesetPromise() +}) diff --git a/mkdocs.yml b/mkdocs.yml index bdc637e..85af293 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -17,7 +17,8 @@ markdown_extensions: - admonition - toc: permalink: true - - pymdownx.arithmatex + - pymdownx.arithmatex: + generic: true - pymdownx.betterem: smart_enable: all - pymdownx.caret @@ -36,7 +37,6 @@ markdown_extensions: extra_javascript: - 'static/tex.js' - - 'https://polyfill.io/v3/polyfill.min.js?features=es6' - 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js' extra_css: - 'static/style.css'