diff options
Diffstat (limited to 'docs/katex-auto.js')
-rw-r--r-- | docs/katex-auto.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/katex-auto.js b/docs/katex-auto.js new file mode 100644 index 0000000..20651d9 --- /dev/null +++ b/docs/katex-auto.js @@ -0,0 +1,14 @@ +// https://github.com/jgm/pandoc/blob/29fa97ab96b8e2d62d48326e1b949a71dc41f47a/src/Text/Pandoc/Writers/HTML.hs#L332-L345 +document.addEventListener("DOMContentLoaded", function () { + var mathElements = document.getElementsByClassName("math"); + var macros = []; + for (var i = 0; i < mathElements.length; i++) { + var texText = mathElements[i].firstChild; + if (mathElements[i].tagName == "SPAN") { + katex.render(texText.data, mathElements[i], { + displayMode: mathElements[i].classList.contains("display"), + throwOnError: false, + macros: macros, + fleqn: false + }); + }}}); |