忽略代码
把代码包裹在 djlint 标签中即可忽略它:
普通 HTML:
<!-- djlint:off -->
<bad html to ignore>
<!-- djlint:on -->
或者写成注释:
{# djlint:off #}
<bad html to ignore>
{# djlint:on #}
或者写成长注释:
{% comment %} djlint:off {% endcomment %}
<bad html to ignore>
{% comment %} djlint:on {% endcomment %}
或者写成 Go 风格的注释:
{{ /* djlint:off */ }}
<bad html to ignore>
{{ /* djlint:on */ }}
或者写成 Handlebars 风格的注释:
{{!-- djlint:off --}}
<bad html to ignore>
{{!-- djlint:on --}}
忽略规则
也可以在忽略块的起始标签中写上规则名称,从而只忽略特定的代码检查规则。
{# 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 */ }}