@@ -55,6 +55,7 @@ import qualified Data.HashMap.Strict as H
5555import qualified Data.Vector as V
5656import qualified Data.Text as T
5757import qualified Data.Set as Set
58+import Network.HTTP ( urlEncode )
5859
5960type Notes = [[Block]]
6061type Ref = ([Inline], Target, Attr)
@@ -856,18 +857,22 @@ inlineToMarkdown opts (Str str) = do
856857 if stPlain st
857858 then return $ text str
858859 else return $ text $ escapeString opts str
859−inlineToMarkdown opts (Math InlineMath str)
860− | isEnabled Ext_tex_math_dollars opts =
861− return $ "$" <> text str <> "$"
862− | isEnabled Ext_tex_math_single_backslash opts =
863− return $ "\\(" <> text str <> "\\)"
864− | isEnabled Ext_tex_math_double_backslash opts =
865− return $ "\\\\(" <> text str <> "\\\\)"
866− | otherwise = do
867− plain <- gets stPlain
868− inlineListToMarkdown opts $
869− (if plain then makeMathPlainer else id) $
870− texMathToInlines InlineMath str
860+inlineToMarkdown opts (Math InlineMath str) =
861+ case writerHTMLMathMethod opts of
862+ WebTeX url ->
863+ inlineToMarkdown opts (Image nullAttr [Str str]
864+ (url ++ urlEncode str, str))
865+ _ | isEnabled Ext_tex_math_dollars opts ->
866+ return $ "$" <> text str <> "$"
867+ | isEnabled Ext_tex_math_single_backslash opts ->
868+ return $ "\\(" <> text str <> "\\)"
869+ | isEnabled Ext_tex_math_double_backslash opts ->
870+ return $ "\\\\(" <> text str <> "\\\\)"
871+ | otherwise -> do
872+ plain <- gets stPlain
873+ inlineListToMarkdown opts $
874+ (if plain then makeMathPlainer else id) $
875+ texMathToInlines InlineMath str
871876inlineToMarkdown opts (Math DisplayMath str)
872877 | isEnabled Ext_tex_math_dollars opts =
873878 return $ "$$" <> text str <> "$$"