Skip to content

Commit ba8f94d

Browse files
authored
chore(docs): remove unused generateToc function (#32111)
1 parent 45c2e8a commit ba8f94d

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

utils/markdown.js

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -461,24 +461,6 @@ function visit(node, visitor, depth = 0) {
461461
visit(n, visitor, depth + 1);
462462
}
463463

464-
/**
465-
* @param {MarkdownNode[]} nodes
466-
* @param {boolean=} h3
467-
* @returns {string}
468-
*/
469-
function generateToc(nodes, h3) {
470-
const result = [];
471-
visitAll(nodes, (node, depth) => {
472-
if (node.type === 'h1' || node.type === 'h2' || (h3 && node.type === 'h3')) {
473-
let link = node.text.toLowerCase();
474-
link = link.replace(/[ ]+/g, '-');
475-
link = link.replace(/[^\w-_]/g, '');
476-
result.push(`${' '.repeat(depth * 2)}- [${node.text}](#${link})`);
477-
}
478-
});
479-
return result.join('\n');
480-
}
481-
482464
/**
483465
* @param {MarkdownNode[]} nodes
484466
* @param {string} language
@@ -509,4 +491,4 @@ function filterNodesForLanguage(nodes, language) {
509491
return result;
510492
}
511493

512-
module.exports = { parse, render, clone, visitAll, visit, generateToc, filterNodesForLanguage, wrapText };
494+
module.exports = { parse, render, clone, visitAll, visit, filterNodesForLanguage, wrapText };

0 commit comments

Comments
 (0)