djLint icon indicating copy to clipboard operation
djLint copied to clipboard

[BUG] [Formatter] {% comment %} djlint:off {% endcomment %} will be abnormally indented

Open we684123 opened this issue 1 year ago • 4 comments

System Info

https://djlint.com/demo/ running with Python 3.10.2; djLint 1.19.16

Issue

if use {% comment %} djlint:off {% endcomment %} will get abnormally indented

How To Reproduce

put on to https://djlint.com/demo/

<nav class="navbar navbar-expand-lg navbar-light bg-light main-nav p-3">
    <div class="collapse navbar-collapse" id="navBar">
        <div class="navbar-nav ml-auto">
            <ul class="navbar-nav mb-2 mb-lg-0">
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle mr-4"
                       href="#"
                       id="navbarDropdownMenuLink"
                       data-bs-toggle="dropdown"
                       aria-haspopup="true"
                       aria-expanded="false">
                        {{ request.user.name }}
                    </a>
                    <div class="dropdown-menu"
                         style="min-width: 105px;
                                width: 105px"
                         aria-labelledby="navbarDropdownMenuLink">
                        {% comment %} djlint:off {% endcomment %}
                        <a class="dropdown-item"
                           href="http://user/login">變更密碼</a>
                        {% comment %} djlint:on {% endcomment %}
                    </div>
                </li>
            </ul>
        </div>
    </div>
</nav>

2023-03-10 15_25_47-HTML Template Linter and Formatter _ djLint — Mozilla Firefox

after remove {% comment %} djlint:off {% endcomment %} , formater is ok, but i get H022 😥

2023-03-10 15_28_30-HTML Template Linter and Formatter _ djLint — Mozilla Firefox

we684123 avatar Mar 10 '23 07:03 we684123

Thanks for the good example!

christopherpickering avatar Mar 10 '23 14:03 christopherpickering

@we684123 sorry for the delay, I should have a fix out shortly.

christopherpickering avatar Apr 04 '23 18:04 christopherpickering

@christopherpickering Thank you for fixing this issue ♪(´▽`)

we684123 avatar Apr 05 '23 05:04 we684123

:tada: This issue has been resolved in version 1.19.17 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

christopherpickering avatar Apr 05 '23 22:04 christopherpickering