Skip to content

fix(comark): preserve nested markup when stringifying del - #387

Merged
farnabaz merged 2 commits into
mainfrom
fix/render-markdown-del-nested
Aug 26, 2026
Merged

fix(comark): preserve nested markup when stringifying del#387
farnabaz merged 2 commits into
mainfrom
fix/render-markdown-del-nested

Conversation

@farnabaz

Copy link
Copy Markdown
Collaborator

Summary

  • Recurse into del children in renderMarkdown (like strong/em) instead of flattening with textContent, so nested inlines such as ~~\x`~~` round-trip correctly
  • Emit del attributes after the closing ~~ delimiter
  • Treat del as an inline tag in HTML stringify so output stays on one line
  • Add SPEC coverage for nested code in del and for del attributes

Fixes #266

Test plan

  • pnpm vitest run test/index.test.ts in packages/comark (656 passed)
  • Confirm ~~\x`parses and stringifies back to`x`~~`
  • Confirm ~~*x*~~{.gone} round-trips attributes and nested emphasis

renderMarkdown flattened del children via textContent, so ~~`x`~~
round-tripped as ~~x~~. Recurse like strong/em, emit attributes, and
treat del as an inline HTML tag. Specs cover nested code and attributes.

Fixes #266
@vercel

vercel Bot commented Aug 26, 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 Aug 26, 2026 2:58pm
comark-json-render Ready Ready Preview Aug 26, 2026 2:58pm
comark-nextjs Ready Ready Preview Aug 26, 2026 2:58pm
comark-nuxt Ready Ready Preview Aug 26, 2026 2:58pm
comark-svelte Ready Ready Preview Aug 26, 2026 2:58pm
comark-sveltekit Ready Ready Preview Aug 26, 2026 2:58pm
comark-twoslash Ready Ready Preview Aug 26, 2026 2:58pm
comark-vue Ready Ready Preview Aug 26, 2026 2:58pm

@pkg-pr-new

pkg-pr-new Bot commented Aug 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark

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

@comark/angular

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

@comark/ansi

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

@comark/html

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

@comark/nuxt

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

@comark/react

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

@comark/svelte

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

@comark/vue

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

commit: 092f510

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

✅ Bundle snapshot updated

Committed the new snapshot as 092f510, verified by re-running the bundle check against it.

GitHub suppresses the events a workflow commit would normally raise, so the ci check above may
still show the earlier failure. Re-run it to refresh the status — the snapshot itself is confirmed green.

Produced by this run.

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.

renderMarkdown drops a code span nested inside <del>

1 participant