summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-05-08 13:31:27 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-05-08 13:31:27 -0700
commitb79df946d1e162c9b6eae82674490b6425b0c9f2 (patch)
tree659dc9baedbba063491c5b8712559988518b38e4
parentffef28e86034db75d5c09ba4c6b5818922ef05ee (diff)
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.
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs6
1 files changed, 3 insertions, 3 deletions
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)