Fixed issue with non-percent encoded anchors in table of contents

This commit is contained in:
squidfunk 2023-03-19 17:21:34 +01:00
parent 4ad2dc1e28
commit c3ba161233
4 changed files with 6 additions and 6 deletions

View File

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

View File

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