mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
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.
This commit is contained in:
parent
2cff287097
commit
3f978d86f6
@ -6,7 +6,7 @@
|
||||
{{ toc_item.title }}
|
||||
</a>
|
||||
{% if toc_item.children %}
|
||||
<nav class="md-nav" aria-label="{{ toc_item.title }}">
|
||||
<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" %}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
<!-- Table of contents list -->
|
||||
{% if toc_item.children %}
|
||||
<nav class="md-nav" aria-label="{{ toc_item.title }}">
|
||||
<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" %}
|
||||
|
Loading…
Reference in New Issue
Block a user