Skip to content

empty markdown lists  #4122

@mlrawlings

Description

@mlrawlings

Empty markdown lists are not idempotent and eventually collapse to incorrect output.

Prettier 1.11.1

Step 1:

When there are spaces after period, they are removed
Playground link

Input:

1. 
2. 
3. 
4. 

Output:

1.
2.
3.
4.

Rendered: (this is fine)
1.
2.
3.
4.

Step 2:

When there are no spaces after period, list collapses
Playground link

Input:

1.
2.
3.
4.

Output:

1. 2. 3. 4.

Rendered: (not okay)

Step 3:

In a collapsed list, single space becomes double space
Playground link

Input:

1. 2. 3. 4.

Output:

1.  2.  3.  4.

Expected behavior:

  1. Running prettier on the same file three times should not result in three different outputs.
  2. Prettier should not change the meaning of the markdown

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:markdownIssues affecting Markdownlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!scope:dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependency

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions