Skip to content

Ignoring code

Code between djlint:off and djlint:on comments is left alone by the formatter and the linter. The comments can be HTML ones:

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

Or Django and Jinja comments:

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

Or {% comment %} blocks:

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

Or Go template comments:

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

Or Handlebars comments:

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

Specific linter rules can also be ignored by adding the rule name into the ignored block opening tag.

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