aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-12-04 10:14:59 -0800
committerJohn MacFarlane <[email protected]>2022-12-04 10:14:59 -0800
commit732ef205462d6a5109dbb588058050b2753bc5cf (patch)
tree3f615bcaf9b194d12abb83b09ff998ccd2fc9081
parentaaa3beacc0c624fc3bd3ac154024a6be36af83af (diff)
HTML writer: include math links if there are raw...
commands or environments that can be interpreted as math e.g. by MathJax. See #8469.
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 99664897e..19186e91c 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -931,7 +931,9 @@ blockToHtmlInner opts (RawBlock f str) = do
else if (f == Format "latex" || f == Format "tex") &&
allowsMathEnvironments (writerHTMLMathMethod opts) &&
isMathEnvironment str
- then blockToHtml opts $ Plain [Math DisplayMath str]
+ then do
+ modify (\st -> st {stMath = True})
+ blockToHtml opts $ Plain [Math DisplayMath str]
else do
report $ BlockNotRendered (RawBlock f str)
return mempty
@@ -1520,9 +1522,13 @@ inlineToHtml opts inline = do
case istex of
True
| allowsMathEnvironments mm && isMathEnvironment str
- -> inlineToHtml opts $ Math DisplayMath str
+ -> do
+ modify (\st -> st {stMath = True})
+ inlineToHtml opts $ Math DisplayMath str
| allowsRef mm && isRef str
- -> inlineToHtml opts $ Math InlineMath str
+ -> do
+ modify (\st -> st {stMath = True})
+ inlineToHtml opts $ Math InlineMath str
_ -> do report $ InlineNotRendered inline
return mempty
(Link attr txt (s,_)) | "mailto:" `T.isPrefixOf` s -> do