prettier/prettier

HTML comments in markdown get endlessly indented

Open

#18 066 ouverte le 13 oct. 2025

Voir sur GitHub
 (2 commentaires) (0 réactions) (1 assigné)JavaScript (51 868 stars) (4 716 forks)batch import
help wantedlang:markdown

Description

Prettier 3.6.2 Playground link

--parser markdown

Input:

- Something:
  - [ ] Foo
  - [ ] Bar
        <!--
          Something else
        -->

Output:

- Something:
  - [ ] Foo
  - [ ] Bar
        <!--
              Something else
            -->

Second Output:

- Something:
  - [ ] Foo
  - [ ] Bar
        <!--
                  Something else
                -->

Expected output:

- Something:
  - [ ] Foo
  - [ ] Bar
        <!--
          Something else
        -->

Why?

IMO, the comment is hanging under the "Bar" item, so it should be indented one level more than it. <!-- and --> should be at the same level. And a re-format should not keep pushing the contents ever to the right.

Guide contributeur