A simple VS Code extension that provides a status bar button to toggle auto-preview mode for markdown files. See source code here
Quick demo showing the toggle functionality in action
workbench.editorAssociations
setting
Auto-Preview Enabled![]() |
Auto-Preview Disabled![]() |
The extension toggles the workbench.editorAssociations
setting for *.md
files between:
"*.md": "vscode.markdown.preview.editor"
- Markdown files open in preview mode by defaultOption 1: VS Code Marketplace (Recommended)
You can also use the command palette (Ctrl+Shift+P
/ Cmd+Shift+P
) and search for “Toggle Markdown Auto Preview”.
To run and test this extension:
F5
to open a new Extension Development Host windowtest-markdown.md
file to test the functionalityThis extension modifies the following VS Code setting:
workbench.editorAssociations
: Controls which editor to use for specific file types
"*.md": "vscode.markdown.preview.editor"
*.md
association is removedmarkdown-auto-preview-toggle.toggle
: Toggle Markdown Auto PreviewVerify that the settings.json for the workspace doesn’t contain the following settings:
{
"workbench.editorAssociations": {
"*.md": "vscode.markdown.preview.editor"
},
}
If present, delete them.
Initial release with basic toggle functionality:
Ensure that you’ve read through the extensions guidelines and follow the best practices for creating your extension.
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
Cmd+\
on macOS or Ctrl+\
on Windows and Linux).Shift+Cmd+V
on macOS or Shift+Ctrl+V
on Windows and Linux).Ctrl+Space
(Windows, Linux, macOS) to see a list of Markdown snippets.Enjoy!