MCPcopy Create free account
hub / github.com/module-federation/module-federation-examples / treeToMarkdown

Function treeToMarkdown

updateReadmeExampleList.js:100–119  ·  view source on GitHub ↗
(tree, depth = 0)

Source from the content-addressed store, hash-verified

98
99// Function to convert tree to markdown
100function treeToMarkdown(tree, depth = 0) {
101 if (!tree) {
102 return '';
103 }
104 let markdown = `${' '.repeat(depth)}- [${tree.name}](${tree.path})`;
105
106 if (tree.rspack || tree.webpack) {
107 markdown += ` -- ${tree.rspack ? '✅ rspack' : '❌ rspack'} | ${
108 tree.webpack ? '✅ webpack' : '❌ webpack'
109 }`;
110 }
111
112 markdown += ` <br> ${tree.description} \n`;
113
114 tree.children.forEach(child => {
115 markdown += treeToMarkdown(child, depth + 1);
116 });
117
118 return markdown;
119}
120
121// Main function
122function main() {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected