From b79df946d1e162c9b6eae82674490b6425b0c9f2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 8 May 2012 13:31:27 -0700 Subject: Treat four or more `~` or `^` in an inline context as regular text. This avoids exponential parsing blowups with long strings of these characters. Closes #507. --- src/Text/Pandoc/Readers/Markdown.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Text/Pandoc/Readers/Markdown.hs') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 19ceb0b53..bd5cd2015 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1026,11 +1026,11 @@ 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 +-- to avoid performance problems, treat 4 or more _ or * or ~ or ^ in a row +-- as a literal rather than attempting to parse for emph/strong/strikeout/super/sub fours :: GenParser Char st Inline fours = try $ do - x <- char '*' <|> char '_' + x <- char '*' <|> char '_' <|> char '~' <|> char '^' count 2 $ satisfy (==x) rest <- many1 (satisfy (==x)) return $ Str (x:x:x:rest) -- cgit v1.2.3