VS Code Extensions
S

Same Tab Markdown Preview Toggle

by ZihuaLiu

Adds editor title buttons to switch the current Markdown file between VS Code's built-in preview and source views.

Downloads

13

Rating

— (0)

Version

0.3.1

Last updated

Jul 21, 2026

Adds two editor title actions for Markdown files:

  • Preview: reopens the current Markdown editor as VS Code's built-in Markdown Preview.
  • Markdown: reopens the built-in Markdown Preview as the source editor.
  • Markdown: Use Preview by Default: makes .md files open with VS Code's built-in Markdown Preview by default.
  • Markdown: Use Markdown Source by Default: restores the default source editor for .md files.

This extension does not render Markdown itself. It reopens the current file with VS Code's built-in vscode.markdown.preview.editor custom editor, so preview behavior, styles, link handling, and security behavior remain the same as the native Markdown extension.

On VS Code versions that expose reopenActiveEditorWith, the extension uses that command. On older VS Code versions such as 1.85.2, it falls back to the public vscode.openWith command and closes the previous non-dirty tab if VS Code opens a duplicate tab.

Default Open Mode

Set currentMarkdownPreviewToggle.defaultMarkdownOpenMode to preview to open .md files with the built-in preview by default. Internally this manages the global VS Code setting:

{
  "workbench.editorAssociations": {
    "*.md": "vscode.markdown.preview.editor"
  }
}

Set it back to source, or run Markdown: Use Markdown Source by Default, to restore the source editor default.

Install From VSIX

code --install-extension same-tab-markdown-preview-toggle-0.3.1.vsix

Or use VS Code:

  1. Open Extensions.
  2. Open the ... menu.
  3. Select Install from VSIX....
  4. Choose same-tab-markdown-preview-toggle-0.3.1.vsix.

Build

npm install
npm run compile
npm run package

Requirement

VS Code 1.85.0 or newer is required.

Related extensions