diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-12-30 23:33:03 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-12-30 23:33:03 -0800 |
commit | a274e15f0d236140fec7e4554117fcb55a219566 (patch) | |
tree | 7cade6451495150d42daf17a28879f54cc62dcbd /src/Text | |
parent | d6d4388f6f738f99c4b337645a1de715e699114d (diff) | |
download | pandoc-a274e15f0d236140fec7e4554117fcb55a219566.tar.gz |
Markdown reader: Avoid parsing raw tex unless \ + letter seen.
This seems to help with the performance problem, #4216.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index e7ad9d8ba..f5e6512f8 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1120,6 +1120,7 @@ rawVerbatimBlock = htmlInBalanced isVerbTag rawTeXBlock :: PandocMonad m => MarkdownParser m (F Blocks) rawTeXBlock = do guardEnabled Ext_raw_tex + lookAhead $ try $ char '\\' >> letter result <- (B.rawBlock "context" . trim . concat <$> many1 ((++) <$> (rawConTeXtEnvironment <|> conTeXtCommand) <*> (blanklines <|> many spaceChar))) @@ -1906,7 +1907,7 @@ inlineNote = try $ do rawLaTeXInline' :: PandocMonad m => MarkdownParser m (F Inlines) rawLaTeXInline' = try $ do guardEnabled Ext_raw_tex - lookAhead (char '\\') + lookAhead $ try $ char '\\' >> letter notFollowedBy' rawConTeXtEnvironment s <- rawLaTeXInline return $ return $ B.rawInline "tex" s -- "tex" because it might be context |