Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect md image link #66958

Merged
merged 7 commits into from
Jan 26, 2019
Merged
Prev Previous commit
Next Next commit
updated test for switched order and new tests for image link
  • Loading branch information
flurmbo committed Jan 26, 2019
commit a7c88d79a2ac768930d40f9a8f65ae91a6a485c7
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,31 @@ suite('markdown.DocumentLinkProvider', () => {
assertRangeEqual(link2.range, new vscode.Range(0, 23, 0, 28));
});

// #49238
test('should handle hyperlinked images', () => {
const links = getLinksForFile('[![alt text](image.jpg)](https://example.com)');
assert.strictEqual(links.length, 2);
const [link1, link2] = links;
assertRangeEqual(link1.range, new vscode.Range(0,25,0,44));
assertRangeEqual(link2.range, new vscode.Range(0,13,0,22));
{
const links = getLinksForFile('[![alt text](image.jpg)](https://example.com)');
assert.strictEqual(links.length, 2);
const [link1, link2] = links;
assertRangeEqual(link1.range, new vscode.Range(0,13,0,22));
assertRangeEqual(link2.range, new vscode.Range(0,25,0,44));
}
{
const links = getLinksForFile('[![a]( whitespace.jpg )]( https://whitespace.com )');
assert.strictEqual(links.length, 2);
const [link1, link2] = links;
assertRangeEqual(link1.range, new vscode.Range(0,7,0,21));
assertRangeEqual(link2.range, new vscode.Range(0,26,0,48));
}
{
const links = getLinksForFile('[![a](img1.jpg)](file1.txt) text [![a](img2.jpg)](file2.txt)');
assert.strictEqual(links.length, 4);
const [link1, link2, link3, link4] = links;
assertRangeEqual(link1.range, new vscode.Range(0,6,0,14));
assertRangeEqual(link2.range, new vscode.Range(0,17,0,26));
assertRangeEqual(link3.range, new vscode.Range(0,39,0,47));
assertRangeEqual(link4.range, new vscode.Range(0,50,0,59));
}
});
});

Expand Down