fix(markdown): avoid considering link references/sources in code sections (#146826)

This commit is contained in:
Akat
2022-04-08 05:50:37 +08:00
committed by GitHub
parent 108baab0c6
commit b499467f9f
3 changed files with 85 additions and 55 deletions

View File

@@ -213,6 +213,26 @@ suite('markdown.DocumentLinkProvider', () => {
assert.strictEqual(links.length, 0);
});
test('Should not consider link references in code fenced with backticks (#146714)', async () => {
const text = joinLines(
'```',
'[a] [bb]',
'```');
const links = await getLinksForFile(text);
assert.strictEqual(links.length, 0);
});
test('Should not consider reference sources in code fenced with backticks (#146714)', async () => {
const text = joinLines(
'```',
'[a]: http://example.com;',
'[b]: <http://example.com>;',
'[c]: (http://example.com);',
'```');
const links = await getLinksForFile(text);
assert.strictEqual(links.length, 0);
});
test('Should not consider links in multiline inline code span between between text', async () => {
const text = joinLines(
'[b](https://1.com) `[b](https://2.com)',