From 7caaa5b2b65a8dd27c2bfceb580c8cdd71f37459 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 11 Dec 2016 17:00:58 +0100 Subject: Fix display math with --webtex in markdown output. Closes #3298. --- src/Text/Pandoc/Writers/Markdown.hs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') 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 && -- cgit v1.2.3