@@ -500,24 +500,24 @@ inlineToMarkdown opts (Str str) = do
500500 else escapeText opts) $ str
501501 return $ literal str'
502502inlineToMarkdown opts (Math InlineMath str) = do
503+ let str' = T. strip str
503504 variant <- asks envVariant
504505 case () of
505506 _ | variant == Markua -> return $ " `" <> literal str <> " `" <> " $"
506507 | otherwise -> case writerHTMLMathMethod opts of
507508 WebTeX url ->
508- let str' = T. strip str
509- in inlineToMarkdown opts
509+ inlineToMarkdown opts
510510 (Image nullAttr [Str str'] (url <> urlEncode str', str'))
511511 _ | isEnabled Ext_tex_math_gfm opts ->
512- return $ " $`" <> literal str <> " `$"
512+ return $ " $`" <> literal str' <> " `$"
513513 | isEnabled Ext_tex_math_dollars opts ->
514- return $ delimited " $" " $ " ( literal str)
514+ return $ " $" <> literal str' <> " $ "
515515 | isEnabled Ext_tex_math_single_backslash opts ->
516- return $ " \\ (" <> literal str <> " \\ )"
516+ return $ " \\ (" <> literal str' <> " \\ )"
517517 | isEnabled Ext_tex_math_double_backslash opts ->
518- return $ " \\\\ (" <> literal str <> " \\\\ )"
518+ return $ " \\\\ (" <> literal str' <> " \\\\ )"
519519 | otherwise ->
520- texMathToInlines InlineMath str >>=
520+ texMathToInlines InlineMath str' >>=
521521 inlineListToMarkdown opts .
522522 (if variant == PlainText then makeMathPlainer else id )
523523
@@ -540,7 +540,7 @@ inlineToMarkdown opts (Math DisplayMath str) = do
540540 $$ literal (T. dropAround (== ' \n ' ) str)
541541 $$ literal " ```" ) <> cr
542542 | isEnabled Ext_tex_math_dollars opts ->
543- return $ delimited " $$" " $$ " ( literal str)
543+ return $ " $$" <> literal str <> " $$ "
544544 | isEnabled Ext_tex_math_single_backslash opts ->
545545 return $ " \\ [" <> literal str <> " \\ ]"
546546 | isEnabled Ext_tex_math_double_backslash opts ->
0 commit comments