mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2025-01-31 03:43:46 +01: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>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% 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 %}
|
{% for path in config.extra_javascript %}
|
||||||
<script src="{{ path | url }}"></script>
|
<script src="{{ path | url }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -176,6 +176,11 @@ export function watchTableOfContents(
|
|||||||
offset = target.offsetTop
|
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 */
|
/* Map reversed anchor path to vertical offset */
|
||||||
return index.set(
|
return index.set(
|
||||||
[...path = [...path, anchor]].reverse(),
|
[...path = [...path, anchor]].reverse(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user