Skip to content

Commit db3ba10

Browse files
committed
Improved graceful handling of missing code annotations
1 parent cb818af commit db3ba10

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

material/assets/javascripts/bundle.289a2a4b.min.js renamed to material/assets/javascripts/bundle.2feb5f25.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/assets/javascripts/bundle.289a2a4b.min.js.map renamed to material/assets/javascripts/bundle.2feb5f25.min.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@
213213
</script>
214214
{% endblock %}
215215
{% block scripts %}
216-
<script src="{{ 'assets/javascripts/bundle.289a2a4b.min.js' | url }}"></script>
216+
<script src="{{ 'assets/javascripts/bundle.2feb5f25.min.js' | url }}"></script>
217217
{% for path in config["extra_javascript"] %}
218218
<script src="{{ path | url }}"></script>
219219
{% endfor %}

src/assets/javascripts/components/content/annotation/list/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ import {
3434

3535
import {
3636
getElement,
37-
getElements
37+
getElements,
38+
getOptionalElement
3839
} from "~/browser"
3940
import { renderAnnotation } from "~/templates"
4041

@@ -118,8 +119,10 @@ export function mountAnnotationList(
118119
const annotations = new Map<number, HTMLElement>()
119120
for (const marker of findAnnotationMarkers(container)) {
120121
const [, id] = marker.textContent!.match(/\((\d+)\)/)!
121-
annotations.set(+id, renderAnnotation(+id))
122-
marker.replaceWith(annotations.get(+id)!)
122+
if (getOptionalElement(`li:nth-child(${id})`, el)) {
123+
annotations.set(+id, renderAnnotation(+id))
124+
marker.replaceWith(annotations.get(+id)!)
125+
}
123126
}
124127

125128
/* Keep list if there are no annotations to render */

0 commit comments

Comments
 (0)