feat: add backlinks to footnotes (#101)

This commit is contained in:
Óscar
2023-08-02 18:35:27 +02:00
committed by GitHub
parent a1ceb74785
commit 5cdc18e688
12 changed files with 80 additions and 14 deletions

1
static/js/footnoteBacklinks.min.js vendored Normal file
View File

@@ -0,0 +1 @@
function assignReferenceIds(){for(const e of document.querySelectorAll(".footnote-reference"))e.id="ref:"+e.children[0].hash.substring(1)}function createFootnoteBacklinks(){for(const n of document.querySelectorAll(".footnote-definition")){var e,t="ref:"+n.id;document.getElementById(t)&&((e=document.createElement("a")).href="#"+t,e.className="footnote-backlink",e.textContent="↩",n.lastElementChild.appendChild(e))}}function initFootnotes(){assignReferenceIds(),createFootnoteBacklinks()}window.addEventListener("load",initFootnotes);