1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-24 07:30:12 +01:00
mkdocs-material/material/partials/toc-item.html
Timothée Mazzucotelli 3f978d86f6 Strip tags of ToC item's aria label
Some plugins/extensions might use the data-toc-label attribute
of headings to set a particular string for the ToC item title.

While not explicitly documented as possible or allowed,
they might set some HTML code instead of text.
In this case, the aria label of Toc nav elements break the HTML
as they will contain unescaped double quotes.

To fix this, we use the `striptags` filter
to remove any tags from the aria label, keeping text only.
2023-05-22 18:27:28 +02:00

18 lines
466 B
HTML

{#-
This file was automatically generated - do not edit
-#}
<li class="md-nav__item">
<a href="{{ toc_item.url }}" class="md-nav__link">
{{ toc_item.title }}
</a>
{% if toc_item.children %}
<nav class="md-nav" aria-label="{{ toc_item.title | striptags }}">
<ul class="md-nav__list">
{% for toc_item in toc_item.children %}
{% include "partials/toc-item.html" %}
{% endfor %}
</ul>
</nav>
{% endif %}
</li>