diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2018-11-05 13:58:11 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-05 13:58:11 -0800 |
commit | 8a491e437f1c8379b66a420f8584c1761b45aa7e (patch) | |
tree | a608c0afd9f238376801e7fcf8588a2bac59f81c /haddock-api/src/Haddock/Backends/Xhtml.hs | |
parent | 0d9a81e20238a6b72f9f5c005f1f7e9cf05f6fb9 (diff) |
Only run MathJax on entities with "mathjax" class (#960)
Correspondingly, we wrap all inline/diplay math in
<span class="mathjax"> ... the math .... </span>
This fixes #959.
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml.hs')
-rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml.hs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml.hs b/haddock-api/src/Haddock/Backends/Xhtml.hs index 6da6a2e8..0a11ca08 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml.hs @@ -120,17 +120,23 @@ copyHtmlBits odir libdir themes withQuickjump = do headHtml :: String -> Themes -> Maybe String -> Html headHtml docTitle themes mathjax_url = - header << [ - meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"], - thetitle << docTitle, - styleSheet themes, - thelink ! [ rel "stylesheet", thetype "text/css", href quickJumpCssFile] << noHtml, - script ! [src haddockJsFile, emptyAttr "async", thetype "text/javascript"] << noHtml, - script ! [src mjUrl, thetype "text/javascript"] << noHtml + header << + [ meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"] + , thetitle << docTitle + , styleSheet themes + , thelink ! [ rel "stylesheet", thetype "text/css", href quickJumpCssFile] << noHtml + , script ! [src haddockJsFile, emptyAttr "async", thetype "text/javascript"] << noHtml + , script ! [thetype "text/x-mathjax-config"] << primHtml mjConf + , script ! [src mjUrl, thetype "text/javascript"] << noHtml ] where - mjUrl = maybe "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" id mathjax_url - + mjUrl = maybe "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" id mathjax_url + mjConf = unwords [ "MathJax.Hub.Config({" + , "tex2jax: {" + , "processClass: \"mathjax\"," + , "ignoreClass: \".*\"" + , "}" + , "});" ] srcButton :: SourceURLs -> Maybe Interface -> Maybe Html srcButton (Just src_base_url, _, _, _) Nothing = |