From 3b57124622e570ebb6a8535cde2bc8533c57c5e1 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Thu, 6 Nov 2025 11:49:21 +0800 Subject: fix: footnote in table ruins layout Former-commit-id: f483f7178d43910621ef303f62c5e89a991f3a61 --- assets/js/inject-footnotes.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/js/inject-footnotes.js b/assets/js/inject-footnotes.js index faf44baf..20086ea6 100644 --- a/assets/js/inject-footnotes.js +++ b/assets/js/inject-footnotes.js @@ -23,7 +23,12 @@ document.addEventListener("DOMContentLoaded", () => { inline.id = noteId; // insert adjacent to paragraph - ref.parentNode.insertAdjacentElement("afterend", inline); + // if it's inside a table, then insert outside the table + if (ref.closest('table')) { + ref.closest('table').insertAdjacentElement("afterend", inline); + } else { + ref.parentNode.insertAdjacentElement("afterend", inline); + } } } // remove original footnotes -- cgit v1.2.3