Skip to content

Commit 7cc3a5b

Browse files
committed
Rebase and fix multiple footnote blocks
1 parent fb726ab commit 7cc3a5b

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/scripts/footnotes.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import { addTooltip } from "~/util/tippy";
22

3-
const footnotes = document.querySelector("section.footnotes");
3+
const footnotes = document.querySelectorAll("section.footnotes");
44

55
if (footnotes) {
6-
const notes = footnotes.querySelectorAll("li");
6+
for (const section of footnotes) {
7+
const notes = section.querySelectorAll("li");
78

8-
for (const note of notes) {
9-
const content = note.querySelector("p") as HTMLParagraphElement;
9+
for (const note of notes) {
10+
const content = note.querySelector("p") as HTMLParagraphElement;
1011

11-
const fnrefs = document.querySelectorAll<HTMLAnchorElement>(
12-
`a[id^='${note.id.replace("fn", "fnref")}']`,
13-
);
12+
const fnrefs = document.querySelectorAll<HTMLAnchorElement>(
13+
`a[id^='${note.id.replace("fn", "fnref")}']`,
14+
);
1415

15-
for (const fnref of fnrefs) {
16-
addTooltip(fnref, content.innerHTML);
16+
for (const fnref of fnrefs) {
17+
addTooltip(fnref, content.innerHTML);
1718

18-
fnref.classList.add("footnote");
19+
fnref.classList.add("footnote");
1920

20-
fnref.setAttribute("tabindex", "0");
21-
fnref.removeAttribute("href");
21+
fnref.setAttribute("tabindex", "0");
22+
fnref.removeAttribute("href");
23+
}
2224
}
23-
}
2425

25-
footnotes.remove();
26+
section.remove();
27+
}
2628
}

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "astro/tsconfigs/strict",
33
"compilerOptions": {
44
"baseUrl": ".",
5+
"target": "ESNext",
56
"paths": {
67
"~/*": ["src/*"]
78
}

0 commit comments

Comments
 (0)