Don't treat escaped markdown reference links as links (#149407)

Fixes #149406

Make sure that escaping the leading `[` of a reference link means it is not considered a link

- Picks up new grammar with fixes
- Updates our document link provider to also not consider these as link
This commit is contained in:
Matt Bierner
2022-05-12 19:35:36 -07:00
committed by GitHub
parent 9e8b4e53ba
commit 113287ccc3
4 changed files with 23 additions and 13 deletions

View File

@@ -172,6 +172,16 @@ suite('markdown.DocumentLinkProvider', () => {
assert.strictEqual(links.length, 0);
});
test('Should not include reference links with escaped leading brackets', async () => {
const links = await getLinksForFile(joinLines(
`\\[bad link][good]`,
`\\[good]`,
`[good]: http://example.com`,
));
assert.strictEqual(links.length, 1);
assertRangeEqual(links[0].range, new vscode.Range(2, 8, 2, 26)); // Should only find the definition
});
test('Should not consider links in code fenced with backticks', async () => {
const links = await getLinksForFile(joinLines(
'```',