diff --git a/extensions/markdown/media/ViewSource.svg b/extensions/markdown/media/ViewSource.svg
new file mode 100644
index 00000000000..85a001dccc2
--- /dev/null
+++ b/extensions/markdown/media/ViewSource.svg
@@ -0,0 +1,3 @@
+
+]>
\ No newline at end of file
diff --git a/extensions/markdown/media/ViewSource_inverse.svg b/extensions/markdown/media/ViewSource_inverse.svg
new file mode 100644
index 00000000000..f6302185aa4
--- /dev/null
+++ b/extensions/markdown/media/ViewSource_inverse.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/extensions/markdown/package.json b/extensions/markdown/package.json
index b789ae079d6..e40ac15c0f6 100644
--- a/extensions/markdown/package.json
+++ b/extensions/markdown/package.json
@@ -42,11 +42,30 @@
"commands": [
{
"command": "extension.previewMarkdown",
- "title": "%markdown.previewMarkdown.title%"
+ "title": "%markdown.previewMarkdown.title%",
+ "context": [{
+ "where": "editor/primary",
+ "when": "markdown",
+ "icon": {
+ "light": "./media/Preview.svg",
+ "dark": "./media/Preview_inverse.svg"
+ }
+ },{
+ "where": "editor/primary",
+ "when": { "scheme": "markdown" },
+ "icon": {
+ "light": "./media/ViewSource.svg",
+ "dark": "./media/ViewSource_inverse.svg"
+ }
+ }]
},
{
"command": "extension.previewMarkdownSide",
- "title": "%markdown.previewMarkdownSide.title%"
+ "title": "%markdown.previewMarkdownSide.title%",
+ "context": {
+ "where": "editor/secondary",
+ "when": "markdown"
+ }
}
],
"keybindings": [
diff --git a/extensions/markdown/src/extension.ts b/extensions/markdown/src/extension.ts
index bbf04e817e4..65b09e9c231 100644
--- a/extensions/markdown/src/extension.ts
+++ b/extensions/markdown/src/extension.ts
@@ -62,7 +62,7 @@ function isMarkdownFile(document: vscode.TextDocument) {
}
function getMarkdownUri(document: vscode.TextDocument) {
- return document.uri.with({ scheme: 'markdown', query: document.uri.toString() });
+ return document.uri.with({ scheme: 'markdown', path: String(document.version), query: document.uri.toString() });
}
function openPreview(sideBySide?: boolean): void {