diff options
author | John MacFarlane <jgm@berkeley.edu> | 2012-05-08 13:31:27 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2012-05-08 13:31:27 -0700 |
commit | b79df946d1e162c9b6eae82674490b6425b0c9f2 (patch) | |
tree | 659dc9baedbba063491c5b8712559988518b38e4 /src/Text/Pandoc | |
parent | ffef28e86034db75d5c09ba4c6b5818922ef05ee (diff) | |
download | pandoc-b79df946d1e162c9b6eae82674490b6425b0c9f2.tar.gz |
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.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 6 |
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) |