prettier: [Markdown] Parsing 2 ULs after each other is broken

As provided by @alexandrtovmach in https://github.com/gatsbyjs/gatsby/pull/18942#issuecomment-549761497, having two ULs after each other, the second one isn’t parsed correctly (using - instead of *). When putting some text in between, it works as expected.

Prettier 1.18.2 Playground link

--parser markdown

Input:

## Two ULs after each other

- List
- List
- List

* List
* List
* List

## Two ULs after each other with some text in between

- List
- List
- List

test

* List
* List
* List

Output:

## Two ULs after each other

- List
- List
- List

* List
* List
* List

## Two ULs after each other with some text in between

- List
- List
- List

test

- List
- List
- List

Expected behavior:

## Two ULs after each other

- List
- List
- List

- List
- List
- List

## Two ULs after each other with some text in between

- List
- List
- List

test

- List
- List
- List

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (17 by maintainers)

Most upvoted comments

I think the current output is correct. According to the spec, changing bullet marker creates a new list. So if Prettier was to change both lists to the same marker, the two lists would suddenly be merged into one list. https://spec.commonmark.org/0.29/#example-271

I think this should be relooked at if it’s an intentional thing.

For me it’s weird too that having lists with multiple list styles and/or 2 lists after each other with a blank line in between them won’t parse these lists to all be -.

Thanks for issue

All list sings are replaced by -.

But when having a combined list (using 2 or more signs from -, * or +), this breaks.