@@ -507,11 +507,18 @@ strictHtmlBlock = try $ do
507507 return $ tag ++ concat contents ++ end
508508
509509rawHtmlBlocks = do
510− htmlBlocks <- many1 rawHtmlBlock
511− let combined = concatMap (\(RawHtml str) -> str) htmlBlocks
512− let combined' = if not (null combined) && last combined == '\n'
513− then init combined -- strip extra newline
514− else combined
510+ htmlBlocks <- many1 $ do (RawHtml blk) <- rawHtmlBlock
511+ sps <- do sp1 <- many spaceChar
512+ sp2 <- option "" (blankline >> return "\n")
513+ sp3 <- many spaceChar
514+ sp4 <- option "" blanklines
515+ return $ sp1 ++ sp2 ++ sp3 ++ sp4
516+ -- note: we want raw html to be able to
517+ -- precede a code block, when separated
518+ -- by a blank line
519+ return $ blk ++ sps
520+ let combined = concat htmlBlocks
521+ let combined' = if last combined == '\n' then init combined else combined
515522 return $ RawHtml combined'
516523
517524--