Skip to content

fix(stringify): handle multiple paragraphs in a list item#169

Merged
farnabaz merged 2 commits into
mainfrom
fix/list-multi-paragraph
Apr 29, 2026
Merged

fix(stringify): handle multiple paragraphs in a list item#169
farnabaz merged 2 commits into
mainfrom
fix/list-multi-paragraph

Conversation

@farnabaz
Copy link
Copy Markdown
Contributor

@farnabaz farnabaz commented Apr 28, 2026

🔗 Linked issue

resolves #168
resolves #167

❓ 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

  • If <li> contains only one paragraph -> the auto unwrap feature will remove that paragraph an unwrap its children
  • If the <li> contains more than one child parser will preserve all tags

📝 Checklist

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

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

Project Deployment Actions Updated (UTC)
comark Ready Ready Preview Apr 28, 2026 2:54pm
comark-json-render Ready Ready Preview Apr 28, 2026 2:54pm
comark-nextjs Ready Ready Preview Apr 28, 2026 2:54pm
comark-nuxt Ready Ready Preview Apr 28, 2026 2:54pm
comark-svelte Ready Ready Preview Apr 28, 2026 2:54pm
comark-twoslash Ready Ready Preview Apr 28, 2026 2:54pm
comark-vue Ready Ready Preview Apr 28, 2026 2:54pm

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 28, 2026

Open in StackBlitz

comark

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

@comark/ansi

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

@comark/html

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

@comark/nuxt

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

@comark/react

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

@comark/svelte

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

@comark/vue

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

commit: b0e30a6

@annaghi
Copy link
Copy Markdown

annaghi commented Apr 28, 2026

This was super fast, thank you! ✨ Multi-paragraph list-item renders correctly.

While reviewing this PR, I realized that I was wrong about the single-paragraph list item requiring p wrapper, IF Comark adheres CommonMark. auto-unwrap should not affect single-paragraph list items, since they do not have a wrapper - according to CommonMark.

On the other hand, this PR makes wrapping and unwrapping consistent: either always wrap into p or always unwrap, rather than mixing the two approaches as Commonmark does. For example:

CommonMark

  • single paragraph list item: li { text }
  • single paragraph blockquote: blockquote { p { text } }

With this PR

autoUnwrap : true

  • single paragraph list item: li { text }
  • single paragraph blockquote: blockquote { text }

autoUnwrap : false

  • single paragraph list item: li { p { text } }
  • single paragraph blockquote: blockquote { p { text } }

Nice, consistent approach! 🔥

@farnabaz farnabaz merged commit e9b9546 into main Apr 29, 2026
10 checks passed
@farnabaz farnabaz deleted the fix/list-multi-paragraph branch April 29, 2026 12:48
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.

bug: Two-paragraph list items are rendered as inline content bug: Single paragraph in list item unwrapped even if autoUnwrap is false

2 participants