@@ -245,15 +245,17 @@ noteMarker :: GenParser Char ParserState [Char]
245245noteMarker = string "[^" >> many1Till (satisfy $ not . isBlank) (char ']')
246246
247247rawLine :: GenParser Char ParserState [Char]
248−rawLine = do
248+rawLine = try $ do
249249 notFollowedBy blankline
250250 notFollowedBy' $ try $ skipNonindentSpaces >> noteMarker
251− contents <- many1 nonEndline
252− end <- option "" (newline >> optional indentSpaces >> return "\n")
253− return $ contents ++ end
251+ optional indentSpaces
252+ anyLine
254253
255254rawLines :: GenParser Char ParserState [Char]
256−rawLines = many1 rawLine >>= return . concat
255+rawLines = do
256+ first <- anyLine
257+ rest <- many rawLine
258+ return $ unlines (first:rest)
257259
258260noteBlock :: GenParser Char ParserState [Char]
259261noteBlock = try $ do
@@ -263,8 +265,9 @@ noteBlock = try $ do
263265 char ':'
264266 optional blankline
265267 optional indentSpaces
266− raw <- sepBy rawLines (try (blankline >> indentSpaces >>
267− notFollowedBy blankline))
268+ raw <- sepBy rawLines
269+ (try (blankline >> indentSpaces >>
270+ notFollowedBy blankline))
268271 optional blanklines
269272 endPos <- getPosition
270273 let newnote = (ref, (intercalate "\n" raw) ++ "\n\n")