summaryrefslogtreecommitdiff
path: root/src/build/remove-footnote-header.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/build/remove-footnote-header.mjs')
-rw-r--r--src/build/remove-footnote-header.mjs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/build/remove-footnote-header.mjs b/src/build/remove-footnote-header.mjs
index 95f481b..37f3af9 100644
--- a/src/build/remove-footnote-header.mjs
+++ b/src/build/remove-footnote-header.mjs
@@ -4,12 +4,18 @@ import { visit } from "unist-util-visit";
// It’s informative but rather useless.
// See below for others examples.
/** @type {import('unified').Plugin<[], import('mdast').Root>} */
-export default function specialBox() {
+export default function specialBox(opt) {
return (tree) => {
- visit(tree, (node) => {
+ visit(tree, (node, _, parent) => {
if (node?.tagName === "h2" && node?.properties?.id === "footnote-label") {
- node.tagName = "hr";
- node.children = []; // Exposure of children, Roman's way
+ node.tagName = "h4";
+ node.children = [{ type: "text", value: opt?.title || "Footnote" }];
+
+ parent.children.unshift({
+ type: "element",
+ tagName: "hr",
+ children: [],
+ });
}
});
};