aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2010-11-28 20:21:07 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2010-11-28 20:21:07 -0800
commit4c21c5566dbf525a2cf9e1a3c979390109d5f788 (patch)
tree82eb03ccdccbdf52b44388539a19cb4417ceaa82 /src/Text/Pandoc/Readers
parent68d38db19468c6a9bb7a4676dd072e7f81f619f2 (diff)
parent3ffd7246173b8bdc0d25167355f55e3193aaa989 (diff)
downloadpandoc-4c21c5566dbf525a2cf9e1a3c979390109d5f788.tar.gz
Merge branch 'master' into citeproc
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index d39050243..b664476b4 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -320,6 +320,9 @@ atxClosing = try $ skipMany (char '#') >> blanklines
setextHeader :: GenParser Char ParserState Block
setextHeader = try $ do
+ -- This lookahead prevents us from wasting time parsing Inlines
+ -- unless necessary -- it gives a significant performance boost.
+ lookAhead $ anyLine >> many1 (oneOf setextHChars) >> blankline
text <- many1Till inline newline
underlineChar <- oneOf setextHChars
many (char underlineChar)