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

This commit is contained in:
Shahed Nasser
2024-12-23 16:27:01 +02:00
committed by GitHub
parent c2c24f40f2
commit c804ae575b
389 changed files with 802 additions and 809 deletions
@@ -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() {