1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-12 01:50:52 +01:00

Fixed table of contents following not working for percent-encoded URIs

This commit is contained in:
squidfunk 2023-03-06 20:27:04 +01:00
parent 19fb69e379
commit 64ca8fefd4
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 6 additions and 6 deletions

View File

@ -240,7 +240,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.b78d2936.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.fc8c2696.min.js' | url }}"></script>
{% for path in config.extra_javascript %}
<script src="{{ path | url }}"></script>
{% endfor %}

View File

@ -134,7 +134,7 @@ export function watchTableOfContents(
/* Compute anchor-to-target mapping */
const anchors = getElements<HTMLAnchorElement>("[href^=\\#]", el)
for (const anchor of anchors) {
const id = decodeURIComponent(anchor.hash.substring(1))
const id = anchor.hash.substring(1)
const target = getOptionalElement(`[id="${id}"]`)
if (typeof target !== "undefined")
table.set(anchor, target)