Skip to content

Markdown inserts unexpected newline in lists #8004

@bbycroft

Description

@bbycroft

If I insert a newline between two top-level list elements, a newline is also inserted between the first top-level element and its children elements (unexpectedly, to my eye).

- Top level item 1
  - Nested item 1
  - Nested item 2
  
- Top level item 2

becomes

- Top level item 1

  - Nested item 1  // (spurious newline inserted above ^)
  - Nested item 2
  
- Top level item 2

I insert the newline between "Nested item 2" and "Top level item 2" intentionally, to keep the the top level items visually distinct, but the effect is slightly ruined by prettier's addition of a newline between "Top level item 1" and "Nested item 1".

That extra insertion doesn't make sense to me, and appears to be a bug.

Playground link is here: https://prettier.io/playground/#...

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.status:needs investigationIssues that need additional investigation, e.g. to understand whether the reported behavior is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions