Skip to content

Commit 891553a

Browse files
jstirnamanCopilot
andcommitted
Apply suggestions from code review
Co-authored-by: Copilot <[email protected]>
1 parent 27c3580 commit 891553a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/scripts/link-extractor.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,13 @@ function extractMarkdownLinks(content, filePath) {
9494
}
9595

9696
// Bare URLs (basic detection, avoid false positives)
97-
const bareUrlRegex = /(?:^|[\s\n])(https?:\/\/[^\s\)\]\}]+)/g;
97+
// Regex to match bare URLs in text
98+
// - (?:^|[\s\n]): Match the start of the line or any whitespace character
99+
// - (https?:\/\/): Match the protocol (http or https) followed by ://
100+
// - [^\s\)\]\}]+: Match the rest of the URL, stopping at spaces or closing characters like ), ], or }
101+
const bareUrlRegex = /(?<start>^|[\s\n])(?<url>https?:\/\/[^\s\)\]\}]+)/g;
98102
while ((match = bareUrlRegex.exec(line)) !== null) {
99-
const url = match[1];
103+
const url = match.groups.url;
100104
const columnStart = match.index + match[0].length - url.length;
101105

102106
// Skip if this URL is already captured in a proper markdown link

0 commit comments

Comments
 (0)