diff options
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index ab146bdd0..cdd75650c 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -939,13 +939,17 @@ failIfLink :: Inline -> GenParser tok st Inline failIfLink (Link _ _) = pzero failIfLink elt = return elt -escapedChar :: GenParser Char ParserState Inline -escapedChar = try $ do +escapedChar' :: GenParser Char ParserState Char +escapedChar' = try $ do char '\\' state <- getState - result <- if stateStrict state - then oneOf "\\`*_{}[]()>#+-.!~" - else satisfy (not . isAlphaNum) + if stateStrict state + then oneOf "\\`*_{}[]()>#+-.!~" + else satisfy (not . isAlphaNum) + +escapedChar :: GenParser Char ParserState Inline +escapedChar = do + result <- escapedChar' return $ case result of ' ' -> Str "\160" -- "\ " is a nonbreaking space '\n' -> LineBreak -- "\[newline]" is a linebreak |