Fixed annotations with nested lists not being mounted correctly

This commit is contained in:
squidfunk 2023-06-23 09:36:45 +02:00
parent a8287eba1b
commit 3be797ece8
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 7 additions and 7 deletions

View File

@ -240,7 +240,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.a51614de.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.b425cdc4.min.js' | url }}"></script>
{% for path in config.extra_javascript %} {% for path in config.extra_javascript %}
{% if path.endswith(".mjs") %} {% if path.endswith(".mjs") %}
<script type="module" src="{{ path | url }}"></script> <script type="module" src="{{ path | url }}"></script>

View File

@ -143,7 +143,7 @@ export function mountAnnotationList(
const annotations = new Map<string, HTMLElement>() const annotations = new Map<string, HTMLElement>()
for (const marker of findAnnotationMarkers(container)) { for (const marker of findAnnotationMarkers(container)) {
const [, id] = marker.textContent!.match(/\((\d+)\)/)! const [, id] = marker.textContent!.match(/\((\d+)\)/)!
if (getOptionalElement(`li:nth-child(${id})`, el)) { if (getOptionalElement(`:scope > li:nth-child(${id})`, el)) {
annotations.set(id, renderAnnotation(id, prefix)) annotations.set(id, renderAnnotation(id, prefix))
marker.replaceWith(annotations.get(id)!) marker.replaceWith(annotations.get(id)!)
} }
@ -162,7 +162,7 @@ export function mountAnnotationList(
for (const [id, annotation] of annotations) for (const [id, annotation] of annotations)
pairs.push([ pairs.push([
getElement(".md-typeset", annotation), getElement(".md-typeset", annotation),
getElement(`li:nth-child(${id})`, el) getElement(`:scope > li:nth-child(${id})`, el)
]) ])
/* Handle print mode - see https://bit.ly/3rgPdpt */ /* Handle print mode - see https://bit.ly/3rgPdpt */