Skip to content

Commit 6626017

Browse files
feat(DocLink): support absolute urls
1 parent 7adeb35 commit 6626017

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/lib/doc-index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ async function getOrBuildKeyIndex(): Promise<Map<string, string>> {
5757
*/
5858
export async function getLinkToKey(key: string): Promise<string | undefined> {
5959
const index = await getOrBuildKeyIndex();
60+
if (key.startsWith("/")) {
61+
if (Object.values(index).some(slug => `/${slug}/` === key || `/${slug}` === key))
62+
return key;
63+
else
64+
return undefined;
65+
}
6066
const slug = index.get(key);
6167
if (!slug) return undefined;
6268
return `/${slug}/`;

0 commit comments

Comments
 (0)