git.iko.soy/typeable/pandoc
on master help sign in
Fix display math with --webtex in markdown output.

Closes #3298.

commit7caaa5b2b65a8dd27c2bfceb580c8cdd71f37459 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 11 Dec 2016, 17:00 (10 years ago) parent0c029e8
1 file changed+13−9
src/Text/Pandoc/Writers/Markdown.hs+13−9
src/Text/Pandoc/Writers/Markdown.hs+13−9
@@ -979,15 +979,19 @@ inlineToMarkdown opts (Math InlineMath str) =
979979 inlineListToMarkdown opts $
980980 (if plain then makeMathPlainer else id) $
981981 texMathToInlines InlineMath str
982−inlineToMarkdown opts (Math DisplayMath str)
983− | isEnabled Ext_tex_math_dollars opts =
984− return $ "$$" <> text str <> "$$"
985− | isEnabled Ext_tex_math_single_backslash opts =
986− return $ "\\[" <> text str <> "\\]"
987− | isEnabled Ext_tex_math_double_backslash opts =
988− return $ "\\\\[" <> text str <> "\\\\]"
989− | otherwise = (\x -> cr <> x <> cr) `fmap`
990− inlineListToMarkdown opts (texMathToInlines DisplayMath str)
982+inlineToMarkdown opts (Math DisplayMath str) =
983+ case writerHTMLMathMethod opts of
984+ WebTeX url -> (\x -> blankline <> x <> blankline) `fmap`
985+ inlineToMarkdown opts (Image nullAttr [Str str]
986+ (url ++ urlEncode str, str))
987+ _ | isEnabled Ext_tex_math_dollars opts ->
988+ return $ "$$" <> text str <> "$$"
989+ | isEnabled Ext_tex_math_single_backslash opts ->
990+ return $ "\\[" <> text str <> "\\]"
991+ | isEnabled Ext_tex_math_double_backslash opts ->
992+ return $ "\\\\[" <> text str <> "\\\\]"
993+ | otherwise -> (\x -> cr <> x <> cr) `fmap`
994+ inlineListToMarkdown opts (texMathToInlines DisplayMath str)
991995inlineToMarkdown opts (RawInline f str) = do
992996 plain <- asks envPlain
993997 if not plain &&