Skip to content

fix(syntax): stop 2+ blank lines from closing nested components early - #323

Merged
farnabaz merged 4 commits into
comarkdown:mainfrom
adamdehaven:fix/issue-322-double-blank-line-in-nested-component
Aug 3, 2026
Merged

fix(syntax): stop 2+ blank lines from closing nested components early#323
farnabaz merged 4 commits into
comarkdown:mainfrom
adamdehaven:fix/issue-322-double-blank-line-in-nested-component

Conversation

@adamdehaven

Copy link
Copy Markdown
Contributor

🔗 Linked issue

#322

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

A run of 2+ consecutive blank lines inside a nested ::component body silently dropped every sibling after the blank run (or, for #slotname slots, emitted a spurious empty paragraph).

Root cause: comark_block_yaml, comark_block_shorthand, and comark_block_slots narrowed state.lineMax after matching but never restored it, unlike comark_block. Since skipEmptyLines is bounded by state.lineMax, the second blank line in a run fell through unskipped and broke the tokenizer's indent check.

  • comark_block_yaml / comark_block_shorthand: removed the stray lineMax narrowing (neither rule recurses, so it served no purpose).
  • comark_block_slots: save/restore lineMax around its recursive tokenize call, matching the existing pattern in comark_block.
  • Verified auto-close/streaming interaction still works with the fix

📝 Checklist

  • I have linked an issue or discussion.
  • I have run pnpm verify and it passes.
  • I have updated the documentation accordingly.

Note

2 pre-existing, unrelated failures in test/inline-component-roundtrip.test.ts (single-char attribute names, e.g. x, get dropped from inline components).

A run of 2+ consecutive blank lines inside a nested component body
silently drops every sibling after the blank line. Fixes comarkdown#322.
@adamdehaven
adamdehaven requested a review from farnabaz as a code owner August 1, 2026 20:53
@vercel

vercel Bot commented Aug 1, 2026

Copy link
Copy Markdown

@adamdehaven is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@adamdehaven

Copy link
Copy Markdown
Contributor Author

@farnabaz can you take a look at this one as well?

@pkg-pr-new

pkg-pr-new Bot commented Aug 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark

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

@comark/angular

npm i https://pkg.pr.new/@comark/angular@323

@comark/ansi

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

@comark/html

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

@comark/nuxt

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

@comark/react

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

@comark/svelte

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

@comark/vue

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

commit: 62a084b

@farnabaz farnabaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@farnabaz
farnabaz merged commit 83f67ae into comarkdown:main Aug 3, 2026
4 of 12 checks passed
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