UNPKG

571 BJavaScriptView Raw
1'use strict';
2
3module.exports = plugin;
4
5/*
6LaTeX requires special handlings of footnotes placed in headings such as \section{}
7We therefore mark each footnote placed in heading for later handling.
8*/
9
10var nodeTypes = ['footnote', 'footnoteDefinition'];
11
12function plugin() {
13 return function headingVisitor(node, index, parent) {
14 if (nodeTypes.includes(node.type) && node.inHeading !== true) {
15 node.inHeading = true;
16 }
17
18 if (node.children) {
19 node.children.forEach(function (n, i) {
20 return headingVisitor(n, i, node);
21 });
22 }
23 };
24}
\No newline at end of file