Prettier 3.6.2
Playground link
# Options (if any):
--parser markdown
Input:
Output:
Expected output:
Why?
According to the CommonMark spec:
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.)
In this example, the loose version renders as
<ul>
<li>
<p>a</p>
<ul>
<li>b</li>
</ul>
</li>
</ul>
while the tight version renders as
<ul>
<li>
a
<ul>
<li>b</li>
</ul>
</li>
</ul>
The removed <p> visibly changes the vertical spacing. Prettier should not change the meaning of Markdown code by switching loose lists to tight or vice versa.
Prettier 3.6.2
Playground link
# Options (if any): --parser markdownInput:
Output:
Expected output:
Why?
According to the CommonMark spec:
In this example, the loose version renders as
a
while the tight version renders as
The removed
<p>visibly changes the vertical spacing. Prettier should not change the meaning of Markdown code by switching loose lists to tight or vice versa.