mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 17:32:41 +00:00
parent
125e308ea4
commit
7a623b31fb
|
@ -771,7 +771,7 @@
|
|||
"dompurify": "^3.0.5",
|
||||
"highlight.js": "^11.8.0",
|
||||
"markdown-it": "^12.3.2",
|
||||
"markdown-it-front-matter": "^0.2.1",
|
||||
"markdown-it-front-matter": "^0.2.4",
|
||||
"morphdom": "^2.6.1",
|
||||
"picomatch": "^2.3.1",
|
||||
"vscode-languageclient": "^8.0.2",
|
||||
|
|
|
@ -11,6 +11,7 @@ import { InsertMarkdownLink, findValidUriInText, shouldInsertMarkdownLinkByDefau
|
|||
import { noopToken } from '../util/cancellation';
|
||||
import { UriList } from '../util/uriList';
|
||||
import { createNewMarkdownEngine } from './engine';
|
||||
import { joinLines } from './util';
|
||||
|
||||
function makeTestDoc(contents: string) {
|
||||
return new InMemoryDocument(vscode.Uri.file('test.md'), contents);
|
||||
|
@ -307,5 +308,36 @@ suite('createEditAddingLinksForUriList', () => {
|
|||
await shouldInsertMarkdownLinkByDefault(createNewMarkdownEngine(), makeTestDoc('<>'), InsertMarkdownLink.Smart, [new vscode.Range(0, 1, 0, 1)], noopToken),
|
||||
false);
|
||||
});
|
||||
|
||||
test('Smart should be disabled in frontmatter', async () => {
|
||||
const textDoc = makeTestDoc(joinLines(
|
||||
`---`,
|
||||
`layout: post`,
|
||||
`title: Blogging Like a Hacker`,
|
||||
`---`,
|
||||
``,
|
||||
`Link Text`
|
||||
));
|
||||
assert.strictEqual(
|
||||
await shouldInsertMarkdownLinkByDefault(createNewMarkdownEngine(), textDoc, InsertMarkdownLink.Smart, [new vscode.Range(0, 0, 0, 0)], noopToken),
|
||||
false);
|
||||
|
||||
assert.strictEqual(
|
||||
await shouldInsertMarkdownLinkByDefault(createNewMarkdownEngine(), textDoc, InsertMarkdownLink.Smart, [new vscode.Range(1, 0, 1, 0)], noopToken),
|
||||
false);
|
||||
});
|
||||
|
||||
test('Smart should enabled after frontmatter', async () => {
|
||||
assert.strictEqual(
|
||||
await shouldInsertMarkdownLinkByDefault(createNewMarkdownEngine(), makeTestDoc(joinLines(
|
||||
`---`,
|
||||
`layout: post`,
|
||||
`title: Blogging Like a Hacker`,
|
||||
`---`,
|
||||
``,
|
||||
`Link Text`
|
||||
)), InsertMarkdownLink.Smart, [new vscode.Range(5, 0, 5, 0)], noopToken),
|
||||
true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -242,10 +242,10 @@ lru-cache@^6.0.0:
|
|||
dependencies:
|
||||
yallist "^4.0.0"
|
||||
|
||||
markdown-it-front-matter@^0.2.1:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/markdown-it-front-matter/-/markdown-it-front-matter-0.2.1.tgz#dca49a827bb3cebb0528452c1d87dff276eb28dc"
|
||||
integrity sha512-ydUIqlKfDscRpRUTRcA3maeeUKn3Cl5EaKZSA+I/f0KOGCBurW7e+bbz59sxqkC3FA9Q2S2+t4mpkH9T0BCM6A==
|
||||
markdown-it-front-matter@^0.2.4:
|
||||
version "0.2.4"
|
||||
resolved "https://registry.yarnpkg.com/markdown-it-front-matter/-/markdown-it-front-matter-0.2.4.tgz#cf29bc8222149b53575699357b1ece697bf39507"
|
||||
integrity sha512-25GUs0yjS2hLl8zAemVndeEzThB1p42yxuDEKbd4JlL3jiz+jsm6e56Ya8B0VREOkNxLYB4TTwaoPJ3ElMmW+w==
|
||||
|
||||
markdown-it@^12.3.2:
|
||||
version "12.3.2"
|
||||
|
|
Loading…
Reference in a new issue