Repository navigation
fix(render): keep code blocks safe inside list containers - #64
Merged
Merged
Conversation
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.
What changed
Keep code blocks inside their intended containers when rendering task lists and definitions. Task bodies start on the line below their checkbox. Definitions render as a term paragraph followed by ordinary GFM list items, preserving nested blocks without depending on a definition-list extension. The definition IR and input parser remain unchanged. Nested lists with an empty rendered first item get a blank line before them; ordinary tight lists keep their formatting. Hard breaks inside headings, link labels, tables and block nodes flattened into inline content become spaces so they cannot close their enclosing Markdown syntax. Redundant nested emphasis wrappers render once, and bracketed nodes cannot combine with following text into unintended links.
Why
The existing nightly Fuzz run found raw HTML escaping from
render_irandmarkdown. A checkbox or nested:marker consumed the opening fence as paragraph text. Raw code and language-label content could then become HTML in a downstream GFM renderer. Empty leading paragraphs also bypass a fix based only on the first IR node's type.Before / After
10. [x] ```htmlon one line; the GFM oracle observes raw<script>alert(1)</script>instead of code. The exact Markdown crash emits raw<z>from a nested definition's code label.just pre-pr: passed (format, Clippy, workspace tests, knowledge validation, script tests, examples, cargo-deny).render_ir362,192 inputs / 61s;markdown411,425 inputs / 61s, no crashes. Exact nightly inputs retained as seeds.render_ircase: an empty first ordered item cannot interrupt a paragraph. Added a failing regression, minimized seed and output-budget test, then fixed the separator using the rendered first item (rendered once within the remaining budget). Both full and minimized crash inputs now replay successfully;just pre-prpassed again.render_ircase: a hard break inside a link label nested in a blockquote heading closed both inline containers before later code, exposing raw HTML. Added the minimized seed and regression, then flattened hard breaks in all single-line inline containers. The original and minimized artifacts replay successfully;just pre-prand a fresh 445,222-input / 61s localrender_irfuzz run pass.(combining into an inline link that consumed later delimiters. Both minimized seeds and regressions are retained. Redundant wrappers are omitted and cross-node link adjacency is escaped; all artifacts replay successfully,just pre-prpasses, and a fresh 500,715-input / 61s localrender_irfuzz run is clean.Risk
Medium: Markdown formatting changes for task and definition lists, hard breaks inside single-line containers now render as spaces, redundant nested emphasis wrappers render once, and a
(after a bracketed node may be escaped. Definitions now use standard list grouping instead of:syntax, so re-parsing the rendered Markdown yields ordinary lists. Text and code content remain intact, and direct parsing of definition-list source still produces the same IR. Knowledge, user documentation and changelog describe the output change. No resource limits or security assertions are relaxed.Checklist