Adapt relative links to work within the docs site or fall back to GitHub URLs.
(content)
| 53 | |
| 54 | /** Adapt relative links to work within the docs site or fall back to GitHub URLs. */ |
| 55 | function adaptLinks(content) { |
| 56 | return content |
| 57 | // Known root-level docs → docs site paths |
| 58 | .replace(/\[([^\]]+)\]\(\.\/packages\/README\.md\)/g, '[$1](/developers/packages/overview)') |
| 59 | .replace(/\[([^\]]+)\]\(\.\/CONTRIBUTING\.md\)/g, '[$1](/developers/contributing)') |
| 60 | .replace(/\[([^\]]+)\]\(\.\/CHANGELOG\.md\)/g, '[$1](/developers/changelog)') |
| 61 | // Remaining relative .md links → GitHub source URLs |
| 62 | .replace(/\[([^\]]+)\]\(\.\/((?!http)[^)]+\.md)\)/g, |
| 63 | `[$1](https://github.com/Drakkar-Software/OctoBot/blob/${DEFAULT_BRANCH}/$2)`); |
| 64 | } |
| 65 | |
| 66 | async function main() { |
| 67 | console.log('Syncing root documentation files...'); |