change indentation of math part in Writers/HTML.hs

This commit is contained in:
mb21 2019-10-14 09:09:20 +02:00 committed by John MacFarlane
parent bfbff3106d
commit 25cb84d8d9

View file

@ -285,8 +285,19 @@ pandocToHtml opts (Pandoc meta blocks) = do
case lookupContext "classoption" metadata of
Just clsops | "fleqn" `elem` (clsops :: [Text]) -> "true"
_ -> "false"
H.script $
"document.addEventListener(\"DOMContentLoaded\", function () {\n var mathElements = document.getElementsByClassName(\"math\");\n for (var i = 0; i < mathElements.length; i++) {\n var texText = mathElements[i].firstChild;\n if (mathElements[i].tagName == \"SPAN\") { katex.render(texText.data, mathElements[i], { displayMode: mathElements[i].classList.contains(\"display\"), throwOnError: false, fleqn: " <> katexFlushLeft <> " } );\n }}});"
H.script $ text $ T.unlines [
"document.addEventListener(\"DOMContentLoaded\", function () {"
, " var mathElements = document.getElementsByClassName(\"math\");"
, " 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,"
, " fleqn: " <> katexFlushLeft
, " });"
, "}}});"
]
nl opts
H.link ! A.rel "stylesheet" !
A.href (toValue $ url ++ "katex.min.css")