mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Fixed anchor tracking not working for anchors in tables
This commit is contained in:
parent
8a812aed83
commit
318903db58
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -240,7 +240,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block scripts %}
|
||||
<script src="{{ 'assets/javascripts/bundle.56861ea1.min.js' | url }}"></script>
|
||||
<script src="{{ 'assets/javascripts/bundle.2a903f2a.min.js' | url }}"></script>
|
||||
{% for path in config.extra_javascript %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -176,6 +176,11 @@ export function watchTableOfContents(
|
||||
offset = target.offsetTop
|
||||
}
|
||||
|
||||
/* Fix anchor offsets in tables - see https://bit.ly/3CUFOcn */
|
||||
let parent = target.offsetParent as HTMLElement
|
||||
for (; parent; parent = parent.offsetParent as HTMLElement)
|
||||
offset += parent.offsetTop
|
||||
|
||||
/* Map reversed anchor path to vertical offset */
|
||||
return index.set(
|
||||
[...path = [...path, anchor]].reverse(),
|
||||
|
Loading…
Reference in New Issue
Block a user