prettier/prettier

HTML comments in markdown get endlessly indented

Open

#18.066 aberto em 13 de out. de 2025

Ver no GitHub
 (2 comments) (0 reactions) (1 assignee)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.

Guia do colaborador