aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-08-26 18:57:14 +0200
committerJohn MacFarlane <[email protected]>2025-08-26 18:57:14 +0200
commit6cff8dfc8af7a20afe8b307e29c010db7b6053d8 (patch)
tree13371d352a099555d9493dab94dc993d60756b47 /src
parent01f97ed55d7914a120b552c046a671c4623d7cd8 (diff)
HTML reader: don't drop the initial newline in a pre element.
Closes #11064.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index fcc1147ca..3c8c9d50b 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -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