aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 600742bee..057aec2ee 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -231,12 +231,10 @@ atxHeader = try $ do
atxClosing = try $ skipMany (char '#') >> blanklines
-setextHeader = choice $ map setextH $ enumFromTo 1 (length setextHChars)
-
-setextH level = try $ do
+setextHeader = try $ do
text <- many1Till inline newline >>= return . normalizeSpaces
- many1 $ char (setextHChars !! (level - 1))
- blanklines
+ level <- choice $ zipWith (\ch lev -> try (many1 $ char ch) >> blanklines >> return lev)
+ setextHChars [1..(length setextHChars)]
return $ Header level text
--