@@ -199,12 +199,16 @@ htmlScript = try $ do
199199htmlBlockElement = choice [ htmlScript, htmlComment, xmlDec, definition ]
200200
201201rawHtmlBlock = try $ do
202− notFollowedBy' (htmlTag "/body" <|> htmlTag "/html")
203202 body <- htmlBlockElement <|> anyHtmlTag <|> anyHtmlEndTag
204203 sp <- many space
205204 state <- getState
206205 if stateParseRaw state then return (RawHtml (body ++ sp)) else return Null
207206
207+-- We don't want to parse </body> or </html> as raw HTML, since these
208+-- are handled in parseHtml.
209+rawHtmlBlock' = do notFollowedBy' (htmlTag "/body" <|> htmlTag "/html")
210+ rawHtmlBlock
211+
208212-- | Parses an HTML comment.
209213htmlComment = try $ do
210214 string "<!--"
@@ -284,7 +288,8 @@ block = choice [ codeBlock
284288 , blockQuote
285289 , para
286290 , plain
287− , rawHtmlBlock ] <?> "block"
291+ , rawHtmlBlock'
292+ ] <?> "block"
288293
289294--
290295-- header blocks