nnw-theme 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/footnotes.js +9 -1
- package/package.json +1 -1
package/assets/footnotes.js
CHANGED
|
@@ -31,7 +31,15 @@ async ({notes = null, plain_links = [], keep_with_word = false} = {}) => {
|
|
|
31
31
|
if (document.querySelectorAll(`[id="${CSS.escape(id)}"]`).length > 1) {
|
|
32
32
|
fail(`footnote ${label(marker)}: more than one element has id ${id}`);
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
// newsfoot shows a Substack note from the elements after its backlink
|
|
35
|
+
// <a id="footnote-N">N</a>, and any other note from the target itself.
|
|
36
|
+
let note = text(target);
|
|
37
|
+
if (marker.matches("a[id^='footnote-anchor-']")) {
|
|
38
|
+
let content = "";
|
|
39
|
+
for (let node = target.nextElementSibling; node && !node.matches("a[id^='footnote-']");
|
|
40
|
+
node = node.nextElementSibling) content += node.textContent;
|
|
41
|
+
note = content.replace(/\s+/g, " ").trim();
|
|
42
|
+
}
|
|
35
43
|
if (note) noteFor.set(marker, note);
|
|
36
44
|
else fail(`footnote ${label(marker)}: note is empty`);
|
|
37
45
|
}
|