(root, subpath = "/")
| 65 | |
| 66 | // Recursively find all md files in the directory. |
| 67 | async function* readMarkdownFiles(root, subpath = "/") { |
| 68 | for (const fname of await readdir(root + subpath)) { |
| 69 | if (fname.startsWith(".")) continue; // ignore .vitepress etc. |
| 70 | if ((await stat(root + subpath + fname)).isDirectory()) yield* readMarkdownFiles(root, subpath + fname + "/"); |
| 71 | else if (fname.endsWith(".md")) yield subpath + fname; |
| 72 | } |
| 73 | } |