How to Preview Markdown in VS Code — Shortcuts, Settings & Extensions
Visual Studio Code provides high-performance native Markdown editing, but configuring synced scrolling, GitHub-accurate typography, Mermaid diagrams, and LaTeX math requires knowing the right keybindings and settings. Here is your definitive reference.
1. Essential Keyboard Shortcuts
Save time without clicking menus. Memorize these five primary shortcuts for navigating preview mode:
| Action | Windows / Linux | macOS |
|---|---|---|
Open Preview to the Side (Split View)Primary | Ctrl + K V | ⌘ + K V |
Open Preview in Active Tab | Ctrl + Shift + V | ⇧ + ⌘ + V |
Switch from Preview Back to Source Code | Ctrl + Shift + V | ⇧ + ⌘ + V |
Lock Preview to Current File | Markdown: Toggle Preview Locking | Markdown: Toggle Preview Locking |
Jump to Source from Preview ElementPrimary | Double-Click element | Double-Click element |
2. Recommended settings.json Configuration
Fine-tune how VS Code syncs scrolling, handles link clicks, and formats line breaks. Open your Command Palette (Ctrl+Shift+P / ⌘+Shift+P), select Preferences: Open User Settings (JSON), and paste these optimal defaults:
// Recommended VS Code Markdown Preview Settings
{
"markdown.preview.scrollEditorWithPreview": true,
"markdown.preview.scrollPreviewWithEditor": true,
"markdown.preview.breaks": true,
"markdown.preview.linkify": true,
"markdown.preview.fontSize": 15,
"markdown.preview.lineHeight": 1.6,
"markdown.preview.doubleClickToSwitchToEditor": true
}truetruefalsetrue14true3. Top 4 VS Code Extensions for Markdown
Out-of-the-box VS Code doesn't support Mermaid diagrams, LaTeX math equations, or export to PDF. These verified extensions supercharge your writing setup:
Markdown Preview Enhanced
The ultimate all-in-one preview replacement. Includes KaTeX/MathJax for math, Mermaid, PlantUML, Chart.js, PDF/HTML export, and presentation slide deck mode.
Markdown Preview Mermaid Support
Adds native rendering for ```mermaid code blocks inside the default built-in VS Code preview window without changing any existing settings.
Markdown Preview Github Styling
Restyles the default VS Code preview with official GitHub CSS stylesheets, fonts, colors, and table designs so your local preview matches github.com pixel for pixel.
Markdown All in One
Productivity powerhouse: automated Table of Contents generation, list completion, math formulas, keyboard shortcuts for bold/italic/links, and quick formatting.
4. Troubleshooting Common VS Code Preview Issues
If your preview isn't rendering properly, check these four common culprits and solutions:
When to Use VS Code vs. Online Markdown Preview
Best in VS Code
- Editing extensive multi-file repositories with Git source control
- Integrated terminal and custom build pipelines (e.g. Nextra, Docusaurus)
- Offline editing of local repository files
Best on MarkdownPreview.net
- Zero-install instant preview on any machine or mobile device
- Built-in Mermaid & KaTeX rendering without installing extensions
- Generate shareable links and clean HTML with a single click