docs-util: fix links in references to current page (#10703)

This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-12-23 16:27:01 +02:00
1 parent c2c24f40f2
commit c804ae575b
389 files changed
+802 -809

No files matched your search

@@ -280,15 +280,22 @@ export class MarkdownTheme extends Theme {
}
getRelativeUrl(absolute: string) {
let url = ""
if (MarkdownTheme.URL_PREFIX.test(absolute)) {
return absolute
url = absolute
} else {
const relative = path.relative(
path.dirname(this.location),
path.dirname(absolute)
)
return path.join(relative, path.basename(absolute)).replace(/\\/g, "/")
url = path.join(relative, path.basename(absolute)).replace(/\\/g, "/")
}
if (url === `page.${this.mdxOutput ? "mdx" : "md"}`) {
url = `./${url}`
}
return url
}
getReflectionTemplate() {