fix: strip the newline right after the <pre> start tag

Fixes #244
This commit is contained in:
dualfroz committed 2026-10-02 16:19:40 +02:00
1 parent 710bc5b8ca
commit 806387f3f6
2 files changed
+12 -6

No files matched your search

+4
View File
@@ -15,6 +15,10 @@ class PreformattedConverter implements ConverterInterface
\assert($preContent !== null);
$preContent = \str_replace('</pre>', '', $preContent);
// A newline right after the <pre> start tag is not part of the content (HTML spec), but the parser keeps it
$preContent = \preg_replace('/^(?:\r\n|\r|\n)/', '', $preContent);
\assert($preContent !== null);
/*
* Checking for the code tag.
* Usually pre tags are used along with code tags. This conditional will check for already converted code tags,