| 114 | } |
| 115 | |
| 116 | async function detectNamespaces() { |
| 117 | const namespaces = []; |
| 118 | const currentDocs = path.join(docsDir, 'docs'); |
| 119 | try { |
| 120 | const stat = await fs.stat(currentDocs); |
| 121 | if (stat.isDirectory()) namespaces.push(currentDocs); |
| 122 | } catch {} |
| 123 | |
| 124 | const versionedRoot = path.join(docsDir, 'versioned_docs'); |
| 125 | try { |
| 126 | const entries = await fs.readdir(versionedRoot, { withFileTypes: true }); |
| 127 | for (const e of entries) { |
| 128 | if (e.isDirectory() && e.name.startsWith('version-')) { |
| 129 | namespaces.push(path.join(versionedRoot, e.name)); |
| 130 | } |
| 131 | } |
| 132 | } catch {} |
| 133 | |
| 134 | return namespaces; |
| 135 | } |
| 136 | |
| 137 | function markdownLinkRewriter(content, rewriter) { |
| 138 | const pattern = /\[[^\]]*?\]\((\/[^)\s]*?)\)/g; |