Fixed Katex standalone script (#6399)
Global macros are now persistent when using the HTML Writer with the --katex option.
This commit is contained in:
parent
287a3fcc51
commit
de0df52998
1 changed files with 2 additions and 0 deletions
|
@ -281,12 +281,14 @@ pandocToHtml opts (Pandoc meta blocks) = do
|
|||
H.script $ text $ T.unlines [
|
||||
"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: " <> katexFlushLeft
|
||||
, " });"
|
||||
, "}}});"
|
||||
|
|
Loading…
Add table
Reference in a new issue