import { visit } from "unist-util-visit"; // This plugin is an example to let users write HTML with directives. // It’s informative but rather useless. // See below for others examples. /** @type {import('unified').Plugin<[], import('mdast').Root>} */ export default function specialBox(opt) { return (tree) => { visit(tree, (node, _, parent) => { if (node?.tagName === "h2" && node?.properties?.id === "footnote-label") { node.tagName = "h3"; node.children = [{ type: "text", value: opt?.title || "Footnote" }]; parent.children.unshift({ type: "element", tagName: "hr", children: [], }); } }); }; }