Skip to content

fix: prevent void HTML elements from swallowing subsequent content#190

Merged
farnabaz merged 1 commit into
mainfrom
fix/html-block-void-elements
May 12, 2026
Merged

fix: prevent void HTML elements from swallowing subsequent content#190
farnabaz merged 1 commit into
mainfrom
fix/html-block-void-elements

Conversation

@atinux

@atinux atinux commented May 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Block-level void HTML elements (<img>, <br>, <input>, etc.) were incorrectly treated as opening tags by the token processor, causing all subsequent content to be nested as their children
  • The fix checks if a parsed html_block is a void element and returns it immediately without scanning for a matching html_block_close token

Test plan

  • Added SPEC tests for <img> and <br> block-level void elements followed by other content
  • Verified non-void elements like <div> still correctly nest their children
  • All existing tests pass

Block-level void elements like <img>, <br>, <input> etc. were treated
as opening tags, causing the token processor to consume all subsequent
tokens as their children. Skip child scanning for void elements since
they never have a matching html_block_close token.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented May 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comark Ready Ready Preview May 11, 2026 8:53pm
comark-json-render Ready Ready Preview May 11, 2026 8:53pm
comark-nextjs Ready Ready Preview May 11, 2026 8:53pm
comark-nuxt Ready Ready Preview May 11, 2026 8:53pm
comark-svelte Ready Ready Preview May 11, 2026 8:53pm
comark-twoslash Ready Ready Preview May 11, 2026 8:53pm
comark-vue Ready Ready Preview May 11, 2026 8:53pm

@pkg-pr-new

pkg-pr-new Bot commented May 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark

npm i https://pkg.pr.new/comark@190

@comark/ansi

npm i https://pkg.pr.new/@comark/ansi@190

@comark/html

npm i https://pkg.pr.new/@comark/html@190

@comark/nuxt

npm i https://pkg.pr.new/@comark/nuxt@190

@comark/react

npm i https://pkg.pr.new/@comark/react@190

@comark/svelte

npm i https://pkg.pr.new/@comark/svelte@190

@comark/vue

npm i https://pkg.pr.new/@comark/vue@190

commit: 2412b17

@farnabaz
farnabaz merged commit 6a27384 into main May 12, 2026
10 checks passed
@farnabaz
farnabaz deleted the fix/html-block-void-elements branch May 12, 2026 10:46
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