mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore(docs): remove unused generateToc function (#32111)
This commit is contained in:
parent
45c2e8a3ed
commit
ba8f94df56
@ -461,24 +461,6 @@ function visit(node, visitor, depth = 0) {
|
|||||||
visit(n, visitor, depth + 1);
|
visit(n, visitor, depth + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {MarkdownNode[]} nodes
|
|
||||||
* @param {boolean=} h3
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
function generateToc(nodes, h3) {
|
|
||||||
const result = [];
|
|
||||||
visitAll(nodes, (node, depth) => {
|
|
||||||
if (node.type === 'h1' || node.type === 'h2' || (h3 && node.type === 'h3')) {
|
|
||||||
let link = node.text.toLowerCase();
|
|
||||||
link = link.replace(/[ ]+/g, '-');
|
|
||||||
link = link.replace(/[^\w-_]/g, '');
|
|
||||||
result.push(`${' '.repeat(depth * 2)}- [${node.text}](#${link})`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result.join('\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {MarkdownNode[]} nodes
|
* @param {MarkdownNode[]} nodes
|
||||||
* @param {string} language
|
* @param {string} language
|
||||||
@ -509,4 +491,4 @@ function filterNodesForLanguage(nodes, language) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { parse, render, clone, visitAll, visit, generateToc, filterNodesForLanguage, wrapText };
|
module.exports = { parse, render, clone, visitAll, visit, filterNodesForLanguage, wrapText };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user