Skip to content

Commit 1602f09

Browse files
committed
Multiline ES6 string literal
1 parent ca49544 commit 1602f09

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/commands/snippet.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ export function registerSnippetCommands(context: vscode.ExtensionContext) {
1818
const textRange = new vscode.Range(editor.selection.start.line, editor.selection.start.character, editor.selection.end.line, editor.selection.end.character);
1919
const text = vscode.window.activeTextEditor.document.getText(textRange);
2020
const filePath = vscode.workspace.asRelativePath(editor.document.uri.fsPath);
21-
const snippet = `---\ntitle: public/${filePath}\n---\n> \`${filePath}\`\n\n\`\`\`${editor.document.languageId}=${editor.selection.start.line + 1}\n${text}\n\`\`\``;
21+
const snippet =
22+
`---
23+
title: public/${filePath}
24+
---
25+
> \`${filePath}\`
26+
27+
\`\`\`${editor.document.languageId}=${editor.selection.start.line + 1}
28+
${text}
29+
\`\`\``;
2230

2331
const noteUrl = await API.newNote(snippet);
2432
const clicked = await vscode.window.showInformationMessage('New Snippet Established!', ...['Copy URL to clip board', 'Open in browser']);

0 commit comments

Comments
 (0)