Skip to content

Commit 7e9f09c

Browse files
committed
Fix cross-reference paths to always be absolute
1 parent 7840a0e commit 7e9f09c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/lib/utils/crossref.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,11 @@ export function lookupRef(name: string): CrossRefTarget | undefined {
121121
export function processCrossRefs(html: string, basePath: string = '', currentPackageId?: string): string {
122122
const index = getCrossRefIndex();
123123

124-
// Helper to build full path with base
125-
const fullPath = (path: string) => `${basePath}/${path}`;
124+
// Helper to build full path with base - ensure it starts with /
125+
const fullPath = (path: string) => {
126+
const full = `${basePath}/${path}`;
127+
return full.startsWith('/') ? full : `/${full}`;
128+
};
126129

127130
// 1. Handle RST role syntax: :class:`Name`, :func:`Name`, :meth:`Name`, :mod:`Name`
128131
// These often get converted to various forms by docutils

0 commit comments

Comments
 (0)