@@ -1057,29 +1057,28 @@ export function extractCodeReferenceLinkMetadata(anchor: Element): CodeReference
10571057 * Process GitHub blob permalinks in HTML and add data attributes for local file handling.
10581058 * Finds blob permalinks (e.g., /blob/[sha]/file.ts#L10), checks if files exist locally,
10591059 * and adds data attributes to enable clicking to open local files.
1060+ * Supports links from any repository owner to work across forks.
10601061 *
10611062 * @param bodyHTML - The HTML content to process
1062- * @param repoOwner - GitHub repository owner
10631063 * @param repoName - GitHub repository name
10641064 * @param authority - Git protocol URL authority (e.g., 'github.com')
10651065 * @param fileExistsCheck - Async function that checks if a file exists locally given its relative path
10661066 * @returns Promise resolving to processed HTML
10671067 */
10681068export async function processPermalinks (
10691069 bodyHTML : string ,
1070- repoOwner : string ,
10711070 repoName : string ,
10721071 authority : string ,
10731072 fileExistsCheck : ( filePath : string ) => Promise < boolean >
10741073) : Promise < string > {
10751074 try {
10761075 const escapedRepoName = escapeRegExp ( repoName ) ;
1077- const escapedRepoOwner = escapeRegExp ( repoOwner ) ;
10781076 const escapedAuthority = escapeRegExp ( authority ) ;
10791077
10801078 // Process blob permalinks (exclude already processed links)
1079+ // Allow any owner to support links across forks
10811080 const blobPattern = new RegExp (
1082- `<a\\s+(?![^>]*data-permalink-processed)([^>]*?href="https?:\/\/${ escapedAuthority } \/${ escapedRepoOwner } \/${ escapedRepoName } \/blob\/[0-9a-f]{40}\/(?<filePath>[^"#]+)#L(?<startLine>\\d+)(?:-L(?<endLine>\\d+))?"[^>]*?)>(?<linkText>[^<]*?)<\/a>` ,
1081+ `<a\\s+(?![^>]*data-permalink-processed)([^>]*?href="https?:\/\/${ escapedAuthority } \/[^\/]+ \/${ escapedRepoName } \/blob\/[0-9a-f]{40}\/(?<filePath>[^"#]+)#L(?<startLine>\\d+)(?:-L(?<endLine>\\d+))?"[^>]*?)>(?<linkText>[^<]*?)<\/a>` ,
10831082 'g'
10841083 ) ;
10851084
0 commit comments