Zum Inhalt springen

Code ignorieren

Code zwischen den Kommentaren djlint:off und djlint:on lassen Formatter und Linter in Ruhe. Das können HTML-Kommentare sein:

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

Oder Kommentare von Django und Jinja:

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

Oder {% comment %}-Blöcke:

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

Oder Kommentare in Go-Templates:

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

Oder Kommentare in Handlebars:

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

Sie können auch einzelne Linter-Regeln ignorieren, indem Sie den Namen der Regel in das öffnende Tag des ignorierten Blocks schreiben.

{# 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 */}}