Repository navigation
🐛 fix(markdown): keep pre whitespace in cell HTML - #2541
Merged
Merged
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
to_markdown()writes a list or table inside a pipe-table cell as raw HTML, and then folds every run of spaces and line feeds in that cell onto one line. For flowing text that changes nothing, but text inside a<pre>,<textarea>or<listing>keeps its whitespace, so the fold changed what it shows:<table><td><ul><li><pre>a b\nc</pre>came back asa b c.In that raw HTML, preformatted text now writes each line feed as
and each space in a run as , which is how attribute values in a cell were already written. The newline the serializer adds after<pre>to protect a leading line feed is written as too; the parser drops it the same way it drops a literal one.The fuzz oracle had a second, separate gap: in a table cell holding a block, it kept a
<br>that only empty blocks follow, such asd<br><p></p>. A browser draws nothing for that break, and the oracle already dropped it everywhere outside a cell. It now drops it in a cell too.Both came from the Markdown fuzz targets; a third report from the same targets no longer reproduces on main.