HTML reader: don't drop the initial newline in a pre element.

Closes #11064.
This commit is contained in:
John MacFarlane
2025-08-26 18:57:14 +02:00
parent 01f97ed55d
commit 6cff8dfc8a
2 changed files with 4 additions and 8 deletions
+2 -6
View File
@@ -659,14 +659,10 @@ pCodeBlock = try $ do
else v ]
contents <- manyTill pAny (pCloses "pre" <|> eof)
let rawText = T.concat $ map tagToText contents
-- drop leading newline if any
let result' = case T.uncons rawText of
Just ('\n', xs) -> xs
_ -> rawText
-- drop trailing newline if any
let result = case T.unsnoc result' of
let result = case T.unsnoc rawText of
Just (result'', '\n') -> result''
_ -> result'
_ -> rawText
return $ B.codeBlockWith attr result
tagToText :: Tag Text -> Text