@@ -100,7 +100,7 @@ extractTagType ('<':rest) =
100100 map toLower $ takeWhile isAlphaNum $ dropWhile isSpaceOrSlash rest
101101extractTagType _ = ""
102102
103−-- | Parse any HTML tag (closing or opening) and return text of tag
103+-- | Parse any HTML tag (opening or self-closing) and return text of tag
104104anyHtmlTag = try $ do
105105 char '<'
106106 spaces
@@ -313,15 +313,16 @@ hrule = try $ do
313313-- code blocks
314314--
315315
316+-- Note: HTML tags in code blocks (e.g. for syntax highlighting) are
317+-- skipped, because they are not portable to output formats other than HTML.
316318codeBlock = try $ do
317319 htmlTag "pre"
318− spaces
319− htmlTag "code"
320− result <- manyTill anyChar (htmlEndTag "code")
321− spaces
322− htmlEndTag "pre"
320+ result <- manyTill
321+ (many1 (satisfy (/= '<')) <|>
322+ ((anyHtmlTag <|> anyHtmlEndTag) >> return ""))
323+ (htmlEndTag "pre")
323324 return $ CodeBlock $ stripTrailingNewlines $
324− decodeCharacterReferences result
325+ decodeCharacterReferences $ concat result
325326
326327--
327328-- block quotes