@@ -363,16 +363,19 @@ hrule = try $ do
365-- read a line indented by a given string
365-- read a line indented by a given string
366+indentedLine :: (HasReaderOptions st, Monad m)
366−indentedLine :: Monad m => String -> ParserT [Char] st m [Char]
367+ => Int -> ParserT [Char] st m [Char]
367indentedLine indents = try $ do
368indentedLine indents = try $ do
368− string indents
369+ lookAhead spaceChar
370+ gobbleAtMostSpaces indents
371-- one or more indented lines, possibly separated by blank lines.
373-- one or more indented lines, possibly separated by blank lines.
372-- any amount of indentation will work.
374-- any amount of indentation will work.
375+indentedBlock :: (HasReaderOptions st, Monad m)
373−indentedBlock :: Monad m => ParserT [Char] st m [Char]
376+ => ParserT [Char] st m [Char]
374indentedBlock = try $ do
377indentedBlock = try $ do
375− indents <- lookAhead $ many1 spaceChar
378+ indents <- length <$> lookAhead (many1 spaceChar)
376 lns <- many1 $ try $ do b <- option "" blanklines
379 lns <- many1 $ try $ do b <- option "" blanklines
377 l <- indentedLine indents
380 l <- indentedLine indents
378 return (b ++ l)
381 return (b ++ l)
@@ -389,10 +392,10 @@ quotedBlock = try $ do
389codeBlockStart :: Monad m => ParserT [Char] st m Char
392codeBlockStart :: Monad m => ParserT [Char] st m Char
390codeBlockStart = string "::" >> blankline >> blankline
393codeBlockStart = string "::" >> blankline >> blankline
392−codeBlock :: Monad m => ParserT [Char] st m Blocks
395+codeBlock :: (HasReaderOptions st, Monad m) => ParserT [Char] st m Blocks
393codeBlock = try $ codeBlockStart >> codeBlockBody
396codeBlock = try $ codeBlockStart >> codeBlockBody
395−codeBlockBody :: Monad m => ParserT [Char] st m Blocks
398+codeBlockBody :: (HasReaderOptions st, Monad m) => ParserT [Char] st m Blocks
396codeBlockBody = try $ B.codeBlock . stripTrailingNewlines <$>
399codeBlockBody = try $ B.codeBlock . stripTrailingNewlines <$>
397 (indentedBlock <|> quotedBlock)
400 (indentedBlock <|> quotedBlock)