Skip to content

fix prefix truncation after empty list items in commonmark renderer - #638

Merged
jgm merged 1 commit into
commonmark:masterfrom
zayeem06:empty-item-prefix
Oct 13, 2026
Merged

jgm merged 1 commit into
commonmark:masterfrom
zayeem06:empty-item-prefix

Conversation

@zayeem06

Copy link
Copy Markdown
Contributor

S_render_node pops marker_width characters from the indentation prefix on every CMARK_NODE_ITEM exit, but the matching push on enter only happens when the item has children, since an empty item takes the BLANKLINE branch instead. An empty item inside a block quote therefore truncates the enclosing "> " prefix, so everything rendered after it escapes the quote: > - a, > -, > - b emits the last item unquoted and the output no longer round-trips. Truncate only when the spaces were actually pushed, mirroring the enter side, with a regression case in the render_commonmark api test.

@jgm
jgm merged commit 7e1e10c into commonmark:master Oct 13, 2026
15 checks passed
@jgm

jgm commented Oct 13, 2026

Copy link
Copy Markdown
Member

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants