docs-site: fix link migration

This commit is contained in:
Glen Huang
2025-10-16 18:57:35 +08:00
parent fc8a65c388
commit f9fe1b8913

View File

@@ -13,7 +13,7 @@ export default function remarkLinkMigration() {
return;
}
// Skip external links, links pointing to /docs already and anchors
if (!node.url || /^(https?:)?\/\/|^#/.test(node.url)) return;
if (!node.url || /^(https?:)?\/\/|mailto:|^#/.test(node.url)) return;
// Remove repeated leading ../ or ./
const cleanUrl = node.url.replace(/^\.\.?|((\.\.?)\/)+|\.md$/g, "");