Skip to content

Prettier mangles lists with mixed list syntaxes #3871

@bmcminn

Description

@bmcminn

In reference to #3025, I'm a little annoyed by this because I've always used hyphens for lists, but in further testing I've discovered that Prettier does not handle mixed list syntaxes well at all.

This behavior is inconvenient at best and an option to override the "preferred" syntax would be ideal.

Prettier 1.10.2
Playground link

Global settings

--parser: markdown
--tab-width: 40

My initial edits before Prettier conversion works as expected:

Input:

- waffles
- syrup
    - tasty
    - viscous

Output:

* waffles
* syrup 
    * tasty
    * viscous

After conversion, I make further edits to my content, which results in the nested non-standard list items to be rendered differently, and also causes the non-standard root list node items to be rendered as a separate list, but still using the non-standard syntax:

** Input: **

* waffles
* syrup
    * tasty
    * viscous
    - dark
* more waffles
* butter
- oj
- toast

** Output: **

* waffles
* syrup
    * tasty
    * viscous
    - dark
* more waffles
* butter

- oj
- toast

There is a linebreak between the root list nodes where Prettier assumes the * and - list syntaxes are two different list contexts.


Expected behavior:
I would expect it to automagically convert the hyphens to asterisks without issue.

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.type:questionQuestions and support requests. Please use Stack Overflow for them, not the issue tracker.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions