Skip to content

Prettier support #751

@lydell

Description

@lydell

I know about #451 and about the following:

https://daringfireball.net/projects/markdown/syntax#list

List items may consist of multiple paragraphs. Each subsequent paragraph in a list item must be indented by either 4 spaces or one tab

But not even the original markdown implementation follows that. Try pasting the following:

- one

  two

…in https://daringfireball.net/projects/markdown/dingus. Result:

<ul>
<li><p>one</p>

<p>two</p></li>
</ul>

And since then, CommonMark has gained popularity, and it allows fewer spaces:

https://spec.commonmark.org/0.28/#example-219

- one

  two
<ul>
<li>
<p>one</p>
<p>two</p>
</li>
</ul>

And here’s the thing: Prettier can auto-format markdown, and it uses CommonMark spec. Which unfortunately means that it turns more 4 spaces into the more good-looking 2 spaces:

Prettier 1.14.3
Playground link

--parser markdown

Input:

- one

    two

Output:

- one

  two

Which means that I cannot use Prettier to format markdown that will be parsed using this package :(

Would you be willing to reconsider this?

  • Not even the original implementation follows the 4 space rule.
  • Most markdown implementations don’t either.
  • Being able to use Prettier would be awesome!

EDIT: This fixes the issue: https://github.com/radude/mdx_truly_sane_lists

Metadata

Metadata

Assignees

No one assigned

    Labels

    3rd-partyShould be implemented as a third party extension.duplicateThe issue has been previously reported.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions