Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(docs): remove unused generateToc function (#32111)

Max Schmittba8f94df56c4
diff --git a/utils/markdown.js b/utils/markdown.js
index 77a405192c..a8ae8d4360 100644
--- a/utils/markdown.js
+++ b/utils/markdown.js
@@ -461,24 +461,6 @@ function visit(node, visitor, depth = 0) {
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 {string} language
@@ -509,4 +491,4 @@ function filterNodesForLanguage(nodes, language) {
return result;
}
-module.exports = { parse, render, clone, visitAll, visit, generateToc, filterNodesForLanguage, wrapText };
+module.exports = { parse, render, clone, visitAll, visit, filterNodesForLanguage, wrapText };