aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-12-11 17:00:58 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2016-12-11 17:00:58 +0100
commit7caaa5b2b65a8dd27c2bfceb580c8cdd71f37459 (patch)
tree6490449501843aea6dad93a292cf6bb24976caad /src/Text/Pandoc
parent0c029e8258268c026fe3d968809a160eecda7428 (diff)
downloadpandoc-7caaa5b2b65a8dd27c2bfceb580c8cdd71f37459.tar.gz
Fix display math with --webtex in markdown output.
Closes #3298.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/Markdown.hs22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs
index d08998eef..e3bb3eea0 100644
--- a/src/Text/Pandoc/Writers/Markdown.hs
+++ b/src/Text/Pandoc/Writers/Markdown.hs
@@ -979,15 +979,19 @@ inlineToMarkdown opts (Math InlineMath str) =
inlineListToMarkdown opts $
(if plain then makeMathPlainer else id) $
texMathToInlines InlineMath str
-inlineToMarkdown opts (Math DisplayMath str)
- | isEnabled Ext_tex_math_dollars opts =
- return $ "$$" <> text str <> "$$"
- | isEnabled Ext_tex_math_single_backslash opts =
- return $ "\\[" <> text str <> "\\]"
- | isEnabled Ext_tex_math_double_backslash opts =
- return $ "\\\\[" <> text str <> "\\\\]"
- | otherwise = (\x -> cr <> x <> cr) `fmap`
- inlineListToMarkdown opts (texMathToInlines DisplayMath str)
+inlineToMarkdown opts (Math DisplayMath str) =
+ case writerHTMLMathMethod opts of
+ WebTeX url -> (\x -> blankline <> x <> blankline) `fmap`
+ inlineToMarkdown opts (Image nullAttr [Str str]
+ (url ++ urlEncode str, str))
+ _ | isEnabled Ext_tex_math_dollars opts ->
+ return $ "$$" <> text str <> "$$"
+ | isEnabled Ext_tex_math_single_backslash opts ->
+ return $ "\\[" <> text str <> "\\]"
+ | isEnabled Ext_tex_math_double_backslash opts ->
+ return $ "\\\\[" <> text str <> "\\\\]"
+ | otherwise -> (\x -> cr <> x <> cr) `fmap`
+ inlineListToMarkdown opts (texMathToInlines DisplayMath str)
inlineToMarkdown opts (RawInline f str) = do
plain <- asks envPlain
if not plain &&