1 | ;
|
2 |
|
3 | module.exports = plugin;
|
4 |
|
5 | /*
|
6 | LaTeX requires special handlings of footnotes placed in headings such as \section{}
|
7 | We therefore mark each footnote placed in heading for later handling.
|
8 | */
|
9 |
|
10 | var nodeTypes = ['footnote', 'footnoteDefinition'];
|
11 |
|
12 | function 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 |