djLint icon indicating copy to clipboard operation
djLint copied to clipboard

[BUG] [Formatter] HTML comments are not indented

Open leetrout opened this issue 2 years ago • 2 comments

System Info

  • OS: Ubuntu 20.04 5.15.79.1-microsoft-standard-WSL2
  • Python Version 3.10.9
  • djLint Version 1.19.15
  • template language: Django

Issue

HTML comments are not indented.

How To Reproduce

Create a new template:

<div>
<!-- this is a comment
with multiple lines
-->
</div>

Format gives this output:

<div>
  <!-- this is a comment
with multiple lines
-->
</div>

Expected it to give something like:

<div>
  <!-- this is a comment
  with multiple lines
  -->
</div>

leetrout avatar Feb 22 '23 04:02 leetrout

Hi @leetrout, comments contents are intentionally ignored. Is there a good case for formatting them?

christopherpickering avatar Feb 22 '23 16:02 christopherpickering

I would expect the closing tag and inner contents to align with the indentation of the opening tag when it is a multiline comment based on the behavior of other popular formatters and how HTML comments are often used deep inside several markup tags.

leetrout avatar Feb 23 '23 00:02 leetrout