Skip to main content

UnclosedHTMLElement


The following examples contain code snippets that either fail or pass this check.

<!-- Dangling open/close must be in conditional branches of the same parent -->
<div>
{% if cond %}
<details>
{% endif %}
<p>
{% if cond %}
</details>
{% endif %}
</p>
</div>

<!-- They must open/close in the same condition -->
<div>
{% if something %}
<details>
{% endif %}

{% if something_else %}
</details>
{% endif %}
</div>

<!-- They must open/close in the correct order -->
<div>
{% if cond %}
<details
<summary>
{% endif %}

{% if cond %}
</details>
</summary>
{% endif %}
</div>

<!-- They must open/close in the same condition -->
<div>
{% if something %}
<details>
{% endif %}

{% if something %}
</details>
{% endif %}
</div>

<!-- They must open/close in the correct order -->
<div>
{% if cond %}
<details>
<summary>
{% endif %}

{% if cond %}
</summary>
</details>
{% endif %}
</div>

<!-- `else` and `unless` evaluate to the negated condition identifier -->
<div>
{% if cond %}
{% else %}
<details>
{% endif %}

{% unless cond %}
</details>
{% endunless %}
</div>

UnclosedHTMLElement:
enabled: true
severity: warning
ParameterDescription
enabledWhether this check is enabled.
severityThe severity of the check.

Anchor to Disabling this checkDisabling this check

Disabling this check isn't recommended.


Was this page helpful?