Skip to content

Commit 0f450ae

Browse files
committed
feat: enhance buildDocLink to support hash fragments in documentation URLs
1 parent 88f685a commit 0f450ae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

webview-ui/src/utils/docLinks.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
export function buildDocLink(path: string, campaign: string): string {
99
// Remove any leading slash from path
1010
const cleanPath = path.replace(/^\//, "")
11-
return `https://docs.roocode.com/${cleanPath}?utm_source=extension&utm_medium=ide&utm_campaign=${encodeURIComponent(campaign)}`
11+
const [basePath, hash] = cleanPath.split("#")
12+
const baseUrl = `https://docs.roocode.com/${basePath}?utm_source=extension&utm_medium=ide&utm_campaign=${encodeURIComponent(campaign)}`
13+
return hash ? `${baseUrl}#${hash}` : baseUrl
1214
}

0 commit comments

Comments
 (0)