diff options
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 6 | ||||
-rw-r--r-- | test/command/7058.md | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index de9075ac4..898905603 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -22,7 +22,7 @@ module Text.Pandoc.Writers.Markdown ( writePlain) where import Control.Monad.Reader import Control.Monad.State.Strict -import Data.Char (isAlphaNum) +import Data.Char (isAlphaNum, isDigit) import Data.Default import Data.List (find, intersperse, sortOn, transpose) import qualified Data.Map as M @@ -987,6 +987,10 @@ inlineListToMarkdown opts lst = do inlist <- asks envInList go (if inlist then avoidBadWrapsInList lst else lst) where go [] = return empty + go (x@Math{}:y@(Str t):zs) + | T.all isDigit (T.take 1 t) -- starts with digit -- see #7058 + = liftM2 (<>) (inlineToMarkdown opts x) + (go (RawInline (Format "html") "<!-- -->" : y : zs)) go (i:is) = case i of Link {} -> case is of -- If a link is followed by another link, or '[', '(' or ':' diff --git a/test/command/7058.md b/test/command/7058.md new file mode 100644 index 000000000..69e5dd445 --- /dev/null +++ b/test/command/7058.md @@ -0,0 +1,6 @@ +``` +% pandoc -f latex -t markdown +5\(-\)8 \(x\) +^D +5$-$`<!-- -->`{=html}8 $x$ +``` |