mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Smart markdown pasting does not occur in tilde code block (#189004)
smart paste checks ~~~ code block
This commit is contained in:
parent
b448b21744
commit
df16c16211
|
@ -66,7 +66,8 @@ const smartPasteRegexes = [
|
|||
{ regex: /\[.*\]\(.*\)/g, isMarkdownLink: true, isInline: true }, // Is a Markdown Link
|
||||
{ regex: /!\[.*\]\(.*\)/g, isMarkdownLink: true, isInline: true }, // Is a Markdown Image Link
|
||||
{ regex: /\[([^\]]*)\]\(([^)]*)\)/g, isMarkdownLink: false, isInline: true }, // In a Markdown link
|
||||
{ regex: /^```[\s\S]*?```$/gm, isMarkdownLink: false, isInline: false }, // In a fenced code block
|
||||
{ regex: /^```[\s\S]*?```$/gm, isMarkdownLink: false, isInline: false }, // In a backtick fenced code block
|
||||
{ regex: /^~~~[\s\S]*?~~~$/gm, isMarkdownLink: false, isInline: false }, // In a tildefenced code block
|
||||
{ regex: /^\$\$[\s\S]*?\$\$$/gm, isMarkdownLink: false, isInline: false }, // In a fenced math block
|
||||
{ regex: /`[^`]*`/g, isMarkdownLink: false, isInline: true }, // In inline code
|
||||
{ regex: /\$[^$]*\$/g, isMarkdownLink: false, isInline: true }, // In inline math
|
||||
|
|
|
@ -141,13 +141,20 @@ suite('createEditAddingLinksForUriList', () => {
|
|||
assert.strictEqual(smartPaste.pasteAsMarkdownLink, true);
|
||||
});
|
||||
|
||||
test('Should evaluate pasteAsMarkdownLink as false for pasting within a code block', () => {
|
||||
test('Should evaluate pasteAsMarkdownLink as false for pasting within a backtick code block', () => {
|
||||
skinnyDocument.getText = function () { return '```\r\n\r\n```'; };
|
||||
const range = new vscode.Range(0, 5, 0, 5);
|
||||
const smartPaste = checkSmartPaste(skinnyDocument, range);
|
||||
assert.strictEqual(smartPaste.pasteAsMarkdownLink, false);
|
||||
});
|
||||
|
||||
test('Should evaluate pasteAsMarkdownLink as false for pasting within a tilde code block', () => {
|
||||
skinnyDocument.getText = function () { return '~~~\r\n\r\n~~~'; };
|
||||
const range = new vscode.Range(0, 5, 0, 5);
|
||||
const smartPaste = checkSmartPaste(skinnyDocument, range);
|
||||
assert.strictEqual(smartPaste.pasteAsMarkdownLink, false);
|
||||
});
|
||||
|
||||
test('Should evaluate pasteAsMarkdownLink as false for pasting within a math block', () => {
|
||||
skinnyDocument.getText = function () { return '$$$\r\n\r\n$$$'; };
|
||||
const range = new vscode.Range(0, 5, 0, 5);
|
||||
|
|
Loading…
Reference in a new issue