Open thacoon opened 1 month ago
djlint reports false positives orphan tags for a snippet in which django templating is used. If I remove the django templating no more orphan tags are reported.
Detects two orphan tags for this snippet:
{% load tailwind_filters %} <div class="relative flex items-center"> <div class="flex h-6 items-center"> <input id="{{ field.id_for_label }}" name="{{ field.html_name }}" {% if field.value %}checked{% endif %} type="checkbox" class="h-5 w-5 rounded border-gray-300 text-primary-black focus:ring-primary-black" {{ field|build_attrs }} /> </div> <label for="{{ field.id_for_label }}" class="ml-3 text-sm font-normal text-typography-default"> {{ field.label|safe }} {% if field.field.required %}<span>*</span>{% endif %} </label> </div>
For this snippet it displays the following error:
H025 3:0 Tag seems to be an orphan. <div class="relative H025 11:2 Tag seems to be an orphan. </label>
No orphan tags are reported when django templating is not used:
<div class="relative flex items-center"> <div class="flex h-6 items-center"> <input type="checkbox" class="h-5 w-5 rounded border-gray-300 text-primary-black focus:ring-primary-black" /> </div> <label class="ml-3 text-sm font-normal text-typography-default"> Label <span>*</span> </label> </div>
[tool.djlint] ignore = "H006,H030,H031" include = "H017,H035" indent = 2 blank_line_after_tag = "load,extends" profile = "django" max_line_length = 120 format_attrite_template_tags = true
System Info
Issue
djlint reports false positives orphan tags for a snippet in which django templating is used. If I remove the django templating no more orphan tags are reported.
How To Reproduce
Detects two orphan tags for this snippet:
For this snippet it displays the following error:
No orphan tags are reported when django templating is not used:
Contents of .djlintrc/pyproject.toml [tool.djlint]