what's the pattern of adding <p> tag to list item? #458

Closed
opened 2026-01-29 14:37:16 +00:00 by claunia · 1 comment
Owner

Originally created by @Edward-Chen-CN on GitHub (Apr 27, 2021).

Sometime the list item surrounded by <p> tag, sometime the value rendered inline. I would like to know what the pattern of adding the <p> tag to the list item or is there any way I can set it always surrounded by <p> tag

<li>content 1</li>
<li><p>content 2</P></li>

Originally created by @Edward-Chen-CN on GitHub (Apr 27, 2021). Sometime the list item surrounded by `<p>` tag, sometime the value rendered inline. I would like to know what the pattern of adding the `<p>` tag to the list item or is there any way I can set it always surrounded by `<p>` tag `<li>content 1</li>` `<li><p>content 2</P></li>`
claunia added the question label 2026-01-29 14:37:16 +00:00
Author
Owner

@xoofx commented on GitHub (Apr 27, 2021):

The difference is between Loose and Tight lists as described in the specs

A list is loose if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is tight. (The difference in HTML output is that paragraphs in a loose list are wrapped in <p> tags, while paragraphs in a tight list are not.)

@xoofx commented on GitHub (Apr 27, 2021): The difference is between Loose and Tight lists as described in the [specs](https://spec.commonmark.org/0.29/#lists) > _A list is loose if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is tight. (The difference in HTML output is that paragraphs in a loose list are wrapped in `<p>` tags, while paragraphs in a tight list are not.)_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#458