aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 03d182f5e..f883bd6d8 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -1469,8 +1469,9 @@ inlineToHtml opts inline = do
if ishtml
then return $ preEscapedText str
else if (f == Format "latex" || f == Format "tex") &&
- allowsMathEnvironments (writerHTMLMathMethod opts) &&
- isMathEnvironment str
+ ((allowsMathEnvironments (writerHTMLMathMethod opts) &&
+ isMathEnvironment str) ||
+ (allowsRef (writerHTMLMathMethod opts) && isRef str))
then inlineToHtml opts $ Math DisplayMath str
else do
report $ InlineNotRendered inline
@@ -1602,6 +1603,9 @@ inDiv cls x = do
(if html5 then H5.div else H.div)
x ! A.class_ (toValue cls)
+isRef :: Text -> Bool
+isRef t = "\\ref{" `T.isPrefixOf` t || "\\eqref{" `T.isPrefixOf` t
+
isMathEnvironment :: Text -> Bool
isMathEnvironment s = "\\begin{" `T.isPrefixOf` s &&
envName `elem` mathmlenvs
@@ -1641,6 +1645,10 @@ allowsMathEnvironments MathML = True
allowsMathEnvironments (WebTeX _) = True
allowsMathEnvironments _ = False
+allowsRef :: HTMLMathMethod -> Bool
+allowsRef (MathJax _) = True
+allowsRef _ = False
+
-- | List of intrinsic event attributes allowed on all elements in HTML4.
intrinsicEventsHTML4 :: [Text]
intrinsicEventsHTML4 =