VS Code Markdown Guide
Write and preview markdown in VS Code. Built-in preview, top extensions, keyboard shortcuts, and advanced tips.
Quick Reference
VS Code markdown shortcuts and syntax at a glance.
| Feature | Syntax | Notes | |
|---|---|---|---|
| Open preview | Ctrl+Shift+V / Cmd+Shift+V | Opens markdown preview in new tab | |
| Preview side by side | Ctrl+K V / Cmd+K V | Opens preview beside editor | |
| Heading H1 | # Heading | Hash + space | |
| Bold | **bold** | Or Ctrl+B / Cmd+B with extension | |
| Italic | *italic* | Or Ctrl+I / Cmd+I with extension | |
| Code inline | `code` | Single backticks | |
| Code block | ```lang | Triple backticks + language name | |
| Link | [text](url) | Or Ctrl+K / Cmd+K with extension | |
| Image |  | Local path or URL | |
| Table | | Col | Col | | Pipe-separated; extension formats on save | |
| Task list | - [ ] todo | GFM checkbox — rendered in preview | |
| Strikethrough | ~~text~~ | GFM extension | |
| Blockquote | > quote | Greater-than sign | |
| Horizontal rule | --- | Three dashes on own line |
Built-in Preview
VS Code ships with a full markdown preview engine. No extensions needed for basic rendering.
Opening the Preview
Two ways to open the markdown preview
What the Preview Supports
VS Code's built-in preview renders full GFM including math
- ✅ Standard markdown (headings, bold, italic, lists)
- ✅ GitHub Flavored Markdown (GFM)
- ✅ Syntax highlighting in code blocks
- ✅ Tables and task lists
- ✅ LaTeX math (KaTeX, since VS Code 1.58)
- ✅ Emoji shortcodes
- ✅ Mermaid diagrams (built in since VS Code 1.121)
- ❌ HTML iframes (sandboxed)
Preview a Mermaid flowchart
Paste this block into a .md file, then open Markdown: Open Preview from the Command Palette.
The preview shows three connected nodes: Draft → Review → Publish.
Mermaid is included in VS Code 1.121 and later. For a shareable copy, paste the same block into the Markdown to PDF converter.
Scroll Sync
Editor and preview scroll positions stay in sync automatically
The editor and preview scroll together. Toggle with the sync icon in the preview toolbar, or disable in settings.
Must-Have Extensions
These four extensions transform VS Code into a professional markdown editing environment.
Markdown All in One
The essential extension — shortcuts, TOC, table formatter, and more
- Ctrl+B / Ctrl+I — bold / italic
- Ctrl+K — insert link
- Alt+Shift+F — format table
- Table of contents generation
- Auto-continue lists on Enter
Prettier — Code Formatter
Auto-formats markdown files on save — tables, line wrapping, headings
Formats tables, wraps long lines, and normalizes headings on save
Markdown Preview Enhanced
Advanced preview with mermaid, math, custom themes, and export to PDF/HTML
- Mermaid, PlantUML, Chart.js diagrams
- KaTeX + MathJax math rendering
- Export to PDF, HTML, PNG directly
- Custom CSS themes for preview
- Presentation / slideshow mode
markdownlint
Linting for consistent markdown style — catches common mistakes
- Missing blank lines around headings
- Inconsistent heading level jumps
- Trailing spaces and hard tabs
- Bare URLs not wrapped in links
- Configurable via .markdownlint.json
Keyboard Shortcuts
Built-in VS Code shortcuts plus Markdown All in One additions for faster editing.
Preview Shortcuts
Open and manage the markdown preview pane
| Ctrl+Shift+V | Open preview in new tab |
| Ctrl+K V | Side-by-side preview |
Formatting Shortcuts (Markdown All in One)
Keyboard shortcuts added by the Markdown All in One extension
| Ctrl+B | Toggle bold |
| Ctrl+I | Toggle italic |
| Ctrl+K | Insert link on selected text |
| Alt+C | Toggle task list checkbox |
| Alt+Shift+F | Format table |
Navigation Shortcuts
Navigate within and between markdown files
| Ctrl+Shift+O | Go to heading (outline) |
| Alt+Z | Toggle word wrap |
| Ctrl+Shift+P | Command palette → "Markdown: Create TOC" |
Editing Shortcuts
General VS Code editing shortcuts that work great with markdown
| Ctrl+Shift+P → Format | Auto-format entire file |
| Alt+↑ / Alt+↓ | Move line up or down |
| Shift+Alt+↓ | Duplicate current line |
Custom Keybindings
Add your own shortcuts in keybindings.json for markdown actions
Snippets & Tasks
VS Code snippets let you insert boilerplate markdown instantly. Tasks automate Pandoc exports.
Markdown Snippets
Define reusable markdown templates in .vscode/markdown.code-snippets
Pandoc Export Task
Automate Pandoc conversions with a VS Code task in tasks.json
- Create
.vscode/tasks.jsonin your project - Press Ctrl+Shift+B to run the build task
- Exports current file to PDF using Pandoc
Git Integration
Markdown files work seamlessly with VS Code's built-in Git support — diffs, history, and source control.
Markdown Diffs in Source Control
VS Code renders word-level diffs for markdown files in the SCM panel
Enable "Diff editor: Word wrap" in settings for long markdown lines
Timeline and File History
View the full git history of any markdown file via the Timeline view
- Access via Explorer panel → Timeline section
- Shows all git commits that touched the file
- Click any commit to open a diff view
- Works for any file tracked by git
Limitations in VS Code Markdown
Features that require extensions or workarounds.
Use Live Share extension for real-time co-editing of markdown files
VS Code is code-first — use preview panel or extensions like Foam for wiki-style editing
Pro Tips
This single extension adds keyboard shortcuts for bold, italic, and links; auto-formatting for lists and tables; a table of contents generator; and paste-as-markdown support. It's the most essential markdown extension for VS Code.
With Prettier installed and set as the default formatter, enable "Format On Save" in VS Code settings (Ctrl+, → search "Format On Save"). Every time you save a .md file, Prettier cleans up tables, wraps lines, and normalizes headings.
Press Alt+Z to toggle word wrap on and off. For markdown files, word wrap is almost always preferable to horizontal scrolling. You can also set "editor.wordWrap": "on" in settings.json for all files.
Press Ctrl+Shift+O (Cmd+Shift+O on Mac) to open the outline view. VS Code builds a tree of all headings in your markdown file, making long documents easy to navigate.
Frequently asked questions
Everything you need to know.
Does VS Code have built-in markdown support?
Yes. VS Code has built-in markdown editing and preview support. Open any .md file and press Ctrl+Shift+V (Windows/Linux) or Cmd+Shift+V (Mac) to see the rendered preview. Press Ctrl+K V (Cmd+K V) to open the preview side by side with the editor. The built-in preview supports GFM, syntax highlighting, and math (with the built-in math renderer).
Export your markdown from VS Code?
Paste your VS Code markdown into our converter and download a polished PDF in one click.