File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -94,9 +94,13 @@ function extractMarkdownLinks(content, filePath) {
94
94
}
95
95
96
96
// Bare URLs (basic detection, avoid false positives)
97
- const bareUrlRegex = / (?: ^ | [ \s \n ] ) ( h t t p s ? : \/ \/ [ ^ \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 > h t t p s ? : \/ \/ [ ^ \s \) \] \} ] + ) / g;
98
102
while ( ( match = bareUrlRegex . exec ( line ) ) !== null ) {
99
- const url = match [ 1 ] ;
103
+ const url = match . groups . url ;
100
104
const columnStart = match . index + match [ 0 ] . length - url . length ;
101
105
102
106
// Skip if this URL is already captured in a proper markdown link
You can’t perform that action at this time.
0 commit comments