Skip to content

🐛 fix(markdown): keep pre whitespace in cell HTML - #2541

Merged
gaborbernat merged 4 commits into
tox-dev:mainfrom
gaborbernat:fix/md-fuzz-meaning
Nov 21, 2026
Merged

gaborbernat merged 4 commits into
tox-dev:mainfrom
gaborbernat:fix/md-fuzz-meaning

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

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 as a b c.

In that raw HTML, preformatted text now writes each line feed as &#10; and each space in a run as &#32;, 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 &#10; 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 as d<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.

@gaborbernat gaborbernat added the bug Something isn't working label Nov 21, 2026
@codspeed

codspeed Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 580 untouched benchmarks
⏩ 91 skipped benchmarks1


Comparing gaborbernat:fix/md-fuzz-meaning (045600f) with main (a58211e)

Open in CodSpeed

Footnotes

  1. 91 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@gaborbernat
gaborbernat merged commit a358f59 into tox-dev:main Nov 21, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant