summaryrefslogtreecommitdiff
path: root/src/build/remove-footnote-header.mjs
blob: 95f481b5e0e08e6738a0580be434e2492fffacd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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() {
  return (tree) => {
    visit(tree, (node) => {
      if (node?.tagName === "h2" && node?.properties?.id === "footnote-label") {
        node.tagName = "hr";
        node.children = []; // Exposure of children, Roman's way
      }
    });
  };
}