diff options
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index adc41238c..f4384d493 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -824,6 +824,7 @@ inlineParsers = [ str , endline , code , charRef + , (fourOrMore '*' <|> fourOrMore '_') , strong , emph , note @@ -921,6 +922,12 @@ mathInline = try $ do notFollowedBy digit return $ intercalate " " words' +-- to avoid performance problems, treat 4 or more _ or * in a row as a literal +-- rather than attempting to parse for emph/strong +fourOrMore :: Char -> GenParser Char st Inline +fourOrMore c = try $ count 4 (char c) >> many (char c) >>= \s -> + return (Str $ replicate 4 c ++ s) + emph :: GenParser Char ParserState Inline emph = ((enclosed (char '*') (notFollowedBy' strong >> char '*') inline) <|> (enclosed (char '_') (notFollowedBy' strong >> char '_' >> |