Przejdź do głównej zawartości

Ignorowanie kodu

Kod między komentarzami djlint:off i djlint:on jest pomijany przez formater i linter. Mogą to być komentarze HTML:

<!-- djlint:off -->
<bad html to ignore>
<!-- djlint:on -->

Albo komentarze Django i Jinja:

{# djlint:off #}
<bad html to ignore>
{# djlint:on #}

Albo bloki {% comment %}:

{% comment %} djlint:off {% endcomment %}
<bad html to ignore>
{% comment %} djlint:on {% endcomment %}

Albo komentarze szablonów Go:

{{/* djlint:off */}}
<bad html to ignore>
{{/* djlint:on */}}

Albo komentarze Handlebars:

{{!-- djlint:off --}}
<bad html to ignore>
{{!-- djlint:on --}}

Można też ignorować konkretne reguły lintera, dopisując nazwę reguły do tagu otwierającego ignorowany blok.

{# djlint:off H025,H026 #}
<p>
{# djlint:on #}
<!-- djlint:off H025-->
<p>
<!-- djlint:on -->
{% comment %} djlint:off H025 {% endcomment %}
<p>
{% comment %} djlint:on {% endcomment %}
{{!-- djlint:off H025 --}}
<p>
{{!-- djlint:on --}}
{{/* djlint:off H025 */}}
<p>
{{/* djlint:on */}}