Ignoring Code

Code can be ignored by wrapping it in djlint tags:

For plain old html -

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

or as a comment -

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

or as a long comment -

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

or as a javascript style comment -

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

or as a golang style comment -

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

Ignoring Rules

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>

<p>
<!-- djlint:on -->

{% comment %} djlint:off H025 {% endcomment %}
</p>

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

<p>{{!-- djlint:on --}} {{ /* djlint:off H025 */ }}</p>

<p>{{ /* djlint:on */ }}</p>
Edit this page Updated Sep 26, 2022