Skip to content

fix: avoid paragraph wrappers for loose list items#476

Open
saschabuehrle wants to merge 1 commit intovercel:mainfrom
saschabuehrle:fix/issue-475-list-item-paragraphs
Open

fix: avoid paragraph wrappers for loose list items#476
saschabuehrle wants to merge 1 commit intovercel:mainfrom
saschabuehrle:fix/issue-475-list-item-paragraphs

Conversation

@saschabuehrle
Copy link

Fixes #475

Loose list items can come through as a single <p> child when models insert blank lines between bullets. This unwraps that single paragraph case in the li renderer so output stays consistent, and adds a regression test for the reported markdown.

Greetings, saschabuehrle

@vercel
Copy link
Contributor

vercel bot commented Mar 23, 2026

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

A member of the Team first needs to authorize it.

const normalizedChildren =
childArray.length === 1 &&
isValidElement(childArray[0]) &&
childArray[0].type === "p"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
childArray[0].type === "p"
childArray[0].type === MemoParagraph

The check childArray[0].type === "p" in MemoLi never matches because hast-util-to-jsx-runtime maps p elements to the MemoParagraph component, making .type the component function rather than the string "p".

Fix on Vercel

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.

Blank lines between list items cause unwanted <p> wrapping inside <li>

1 participant