mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
Exclude empty links from md results (#153161)
These are technically valid links but we don't care about them since they take up no space
This commit is contained in:
parent
f8663bce69
commit
8acfd0ae60
|
@ -219,7 +219,7 @@ const linkPattern = new RegExp(
|
|||
r`\(\s*)` + // <-- close prefix match
|
||||
/**/r`(` +
|
||||
/*****/r`[^\s\(\)\<](?:[^\s\(\)]|\([^\s\(\)]*?\))*|` + // Link without whitespace, or...
|
||||
/*****/r`<[^<>]*>` + // In angle brackets
|
||||
/*****/r`<[^<>]+>` + // In angle brackets
|
||||
/**/r`)` +
|
||||
|
||||
// Title
|
||||
|
|
|
@ -461,6 +461,17 @@ suite('Markdown: MdLinkComputer', () => {
|
|||
new vscode.Range(5, 7, 5, 17),
|
||||
]);
|
||||
});
|
||||
|
||||
test('Should not include link with empty angle bracket', async () => {
|
||||
const links = await getLinksForFile(joinLines(
|
||||
`[](<>)`,
|
||||
`[link](<>)`,
|
||||
`[link](<> "text")`,
|
||||
`[link](<> 'text')`,
|
||||
`[link](<> (text))`,
|
||||
));
|
||||
assertLinksEqual(links, []);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue