@@ -245,15 +245,17 @@ noteMarker :: GenParser Char ParserState [Char]
245noteMarker = string "[^" >> many1Till (satisfy $ not . isBlank) (char ']')
245noteMarker = string "[^" >> many1Till (satisfy $ not . isBlank) (char ']')
247rawLine :: GenParser Char ParserState [Char]
247rawLine :: GenParser Char ParserState [Char]
248−rawLine = do
248+rawLine = try $ do
249 notFollowedBy blankline
249 notFollowedBy blankline
250 notFollowedBy' $ try $ skipNonindentSpaces >> noteMarker
250 notFollowedBy' $ try $ skipNonindentSpaces >> noteMarker
251− contents <- many1 nonEndline
252− end <- option "" (newline >> optional indentSpaces >> return "\n")
251+ optional indentSpaces
253− return $ contents ++ end
252+ anyLine
255rawLines :: GenParser Char ParserState [Char]
254rawLines :: GenParser Char ParserState [Char]
256−rawLines = many1 rawLine >>= return . concat
255+rawLines = do
257+ rest <- many rawLine
258+ return $ unlines (first:rest)
258noteBlock :: GenParser Char ParserState [Char]
260noteBlock :: GenParser Char ParserState [Char]
259noteBlock = try $ do
261noteBlock = try $ do
@@ -263,8 +265,9 @@ noteBlock = try $ do
264 optional blankline
266 optional blankline
265 optional indentSpaces
267 optional indentSpaces
268+ raw <- sepBy rawLines
266− raw <- sepBy rawLines (try (blankline >> indentSpaces >>
269+ (try (blankline >> indentSpaces >>
267− notFollowedBy blankline))
270+ notFollowedBy blankline))
268 optional blanklines
271 optional blanklines
269 endPos <- getPosition
272 endPos <- getPosition
270 let newnote = (ref, (intercalate "\n" raw) ++ "\n\n")
273 let newnote = (ref, (intercalate "\n" raw) ++ "\n\n")