@@ -363,16 +363,19 @@ hrule = try $ do
363363--
364364
365365-- read a line indented by a given string
366−indentedLine :: Monad m => String -> ParserT [Char] st m [Char]
366+indentedLine :: (HasReaderOptions st, Monad m)
367+ => Int -> ParserT [Char] st m [Char]
367368indentedLine indents = try $ do
368− string indents
369+ lookAhead spaceChar
370+ gobbleAtMostSpaces indents
369371 anyLine
370372
371373-- one or more indented lines, possibly separated by blank lines.
372374-- any amount of indentation will work.
373−indentedBlock :: Monad m => ParserT [Char] st m [Char]
375+indentedBlock :: (HasReaderOptions st, Monad m)
376+ => ParserT [Char] st m [Char]
374377indentedBlock = try $ do
375− indents <- lookAhead $ many1 spaceChar
378+ indents <- length <$> lookAhead (many1 spaceChar)
376379 lns <- many1 $ try $ do b <- option "" blanklines
377380 l <- indentedLine indents
378381 return (b ++ l)
@@ -389,10 +392,10 @@ quotedBlock = try $ do
389392codeBlockStart :: Monad m => ParserT [Char] st m Char
390393codeBlockStart = string "::" >> blankline >> blankline
391394
392−codeBlock :: Monad m => ParserT [Char] st m Blocks
395+codeBlock :: (HasReaderOptions st, Monad m) => ParserT [Char] st m Blocks
393396codeBlock = try $ codeBlockStart >> codeBlockBody
394397
395−codeBlockBody :: Monad m => ParserT [Char] st m Blocks
398+codeBlockBody :: (HasReaderOptions st, Monad m) => ParserT [Char] st m Blocks
396399codeBlockBody = try $ B.codeBlock . stripTrailingNewlines <$>
397400 (indentedBlock <|> quotedBlock)
398401