Markdown in VS Code: Editing, Previewing, and Extensions
How to write, preview, and publish markdown in VS Code. Covers built-in features, keyboard shortcuts, recommended extensions, and advanced workflows.
Last updated: February 27, 2026
VS Code has first-class markdown support built in. You get syntax highlighting, a live preview, an outline view, and IntelliSense for links and images without installing anything. Extensions add linting, table formatting, paste-as-markdown, and direct publishing.
Built-In Features
Live Preview
Open any .md file and press Ctrl+Shift+V (Windows/Linux) or Cmd+Shift+V (macOS) to open the preview in a new tab.
For side-by-side editing: press Ctrl+K V (Cmd+K V on macOS). This splits the editor with the preview on the right. The preview scrolls in sync with the editor.
The preview renders GFM: headings, bold, italic, code blocks with syntax highlighting, tables, task lists, and strikethrough all display correctly.
Outline View
The Explorer sidebar includes an Outline panel that shows all headings in the current document as a collapsible tree. Click a heading to jump to that section. This is useful for navigating long documents.
IntelliSense for Links
When you type [text](, VS Code shows autocomplete suggestions for:
- Files in the workspace (for relative links)
- Headings in the current file (for anchor links)
- Images in the workspace
Type # inside the parentheses to filter by heading.
Drag-and-Drop Images
Drag an image file from the Explorer or your filesystem into a markdown file. VS Code inserts the image syntax with the correct relative path:
You can also paste images from the clipboard. VS Code saves the image to the workspace and inserts the reference.
Snippets
VS Code includes built-in markdown snippets:
| Trigger | Inserts |
|---|---|
bold | **text** |
italic | *text* |
link | [text](url) |
image |  |
code | Fenced code block |
Type the trigger word and press Tab to expand.
Keyboard Shortcuts
| Action | Windows/Linux | macOS |
|---|---|---|
| Open preview | Ctrl+Shift+V | Cmd+Shift+V |
| Side-by-side preview | Ctrl+K V | Cmd+K V |
| Toggle bold | Ctrl+B | Cmd+B |
| Toggle italic | Ctrl+I | Cmd+I |
| Toggle strikethrough | (extension-dependent) | (extension-dependent) |
| Format document | Shift+Alt+F | Shift+Option+F |
| Go to heading | Ctrl+Shift+O | Cmd+Shift+O |
| Open file by name | Ctrl+P | Cmd+P |
Bold and italic toggle shortcuts work natively: select text and press the shortcut to wrap or unwrap the markers.
Recommended Extensions
| Extension | Purpose | Users |
|---|---|---|
| Markdown All in One | Keyboard shortcuts, TOC generation, list editing, auto-preview | 5M+ |
| markdownlint | Linting for consistent markdown style | 4M+ |
| Markdown Preview Enhanced | Extended preview with diagrams, math, PDF export | 2M+ |
| Paste Image | Paste clipboard images directly into markdown | 500K+ |
| Markdown Table Formatter | Auto-format and align table columns | 300K+ |
| MDtoLink | Publish markdown to shareable URLs from VS Code | - |
Markdown All in One
The most popular markdown extension. Adds:
- TOC generation (insert and auto-update)
- List continuation (press Enter to continue a list)
- Keyboard shortcuts for all formatting
- Section numbering
- Print to HTML
markdownlint
Enforces markdown style rules. Catches common issues:
- Missing blank lines before headings
- Inconsistent list markers
- Multiple H1 headings
- Trailing spaces
- Long lines
Configure rules in .markdownlint.json at the project root.
MDtoLink Extension
Publish any markdown file to a shareable URL without leaving VS Code:
- Open a
.mdfile - Open the command palette (
Ctrl+Shift+P) - Run “MDtoLink: Publish File”
- Get a shareable URL
The extension connects to your MDtoLink account and publishes the active file. See the VS Code integration guide for setup instructions.
Settings for Markdown
Useful VS Code settings for markdown editing (add to settings.json):
{ "markdown.preview.fontSize": 14, "markdown.preview.lineHeight": 1.6, "editor.wordWrap": "on", "editor.minimap.enabled": false, "files.associations": { "*.mdx": "markdown" }}| Setting | What It Does |
|---|---|
markdown.preview.fontSize | Preview text size |
markdown.preview.lineHeight | Preview line spacing |
editor.wordWrap | Wrap long lines in the editor |
editor.minimap.enabled | Hide the minimap for more writing space |
files.associations | Treat .mdx files as markdown for syntax highlighting |
VS Code vs Other Editors for Markdown
| Feature | VS Code | Obsidian | Typora | iA Writer |
|---|---|---|---|---|
| Live preview | Side-by-side | WYSIWYG | WYSIWYG | WYSIWYG |
| Git integration | Built-in | Plugin | No | No |
| Extension ecosystem | Huge | Large | Limited | None |
| Code editing | Yes | Basic | No | No |
| Price | Free | Free (core) | $14.99 | $49.99 |
| Platforms | Win/Mac/Linux | Win/Mac/Linux | Win/Mac/Linux | Mac/Win/iOS/Android |
VS Code is the best choice if you write both code and markdown. Obsidian is better for personal knowledge management and linked notes. Typora and iA Writer are better for distraction-free writing.
Advanced Workflows
Preview Custom CSS
Customize the preview appearance by adding a CSS file:
- Create a
.vscode/markdown.cssfile in your workspace - Add to settings:
{ "markdown.styles": [".vscode/markdown.css"]}- Style the preview:
body { font-family: "Inter", sans-serif; max-width: 720px; margin: 0 auto;}Workspace Snippets for Templates
Create project-specific snippets for repeated content. In .vscode/markdown.code-snippets:
{ "Blog Post Frontmatter": { "prefix": "frontmatter", "body": [ "---", "title: \"$1\"", "description: \"$2\"", "date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE", "tags: [$3]", "---", "", "$0" ] }}Type frontmatter and press Tab to insert the template with cursor positions.
FAQ
Does VS Code support markdown out of the box?
Yes. VS Code includes syntax highlighting, a live preview (Ctrl+Shift+V), an outline view, IntelliSense for links, and basic formatting shortcuts (bold, italic) without any extensions.
What is the best markdown extension for VS Code?
Markdown All in One is the most popular and covers the most use cases: TOC generation, keyboard shortcuts, list editing, and preview enhancements. For linting, add markdownlint.
Can I export markdown to PDF from VS Code?
Not natively. Use the Markdown Preview Enhanced extension, which adds PDF, HTML, and image export. You can also use Pandoc from the integrated terminal: pandoc file.md -o file.pdf.
How do I publish markdown from VS Code?
Install the MDtoLink extension, open a .md file, and run the “Publish File” command. You get a shareable URL in seconds without leaving the editor.
Try It Out
If you are already in VS Code, create a new .md file and start writing. Use Ctrl+K V for a side-by-side preview. When your document is ready, publish it to a shareable URL with the MDtoLink extension or the web editor.
For the full syntax, see the markdown cheat sheet.
Founder, MDtoLink
David builds developer tools and writes about markdown workflows, documentation, and AI-assisted publishing.
Publish your markdown to a shareable URL
One command. Free to start. No credit card.