Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[3.6 regression] Semantically changes Markdown loose list to tight list #17746

Copy link
Copy link

Description

@andersk
Issue body actions

Prettier 3.6.2
Playground link

# Options (if any):
--parser markdown

Input:

- a

  - b

Output:

- a
  - b

Expected output:

- a

  - b

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>
  • a

    • b

while the tight version renders as

<ul>
  <li>
    a
    <ul>
      <li>b</li>
    </ul>
  </li>
</ul>
  • a
    • b

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.