# all·markdown

Markdown in VS Code

VS Code previews Markdown without anything installed — Ctrl+K then V opens it beside the file. What follows is the shortcut list worth memorising, the three settings that explain most surprises, and an honest read on which extensions earn their place.

This is what the built-in preview renders — edit and compare

Result

Open the full editor Runs in this tab — nothing is uploaded.

Opening the preview

ShortcutWhat it does
Ctrl+K VPreview beside the file — the one to learn
Ctrl+Shift+VPreview in place of the editor
Ctrl+Shift+PCommand palette, then "Markdown"

Use Cmd instead of Ctrl on a Mac. The side-by-side preview scrolls in sync with the editor in both directions, and clicking a line in the preview moves the cursor to it.

Three settings that explain most surprises

markdown.preview.breaks — off by default. A single newline joins lines into a paragraph, which is correct standard Markdown and not what GitHub comments do. Turn it on to match a GitHub comment, and remember that the file itself still renders the standard way everywhere else.

editor.wordWrap — set it to on for Markdown specifically. Prose in a horizontally scrolling editor is miserable, and the setting is per-language:

"[markdown]": {
  "editor.wordWrap": "on",
  "editor.quickSuggestions": false
}

The default formatter. If Prettier is reflowing your paragraphs, set "proseWrap": "preserve" — otherwise every save rewraps the file and the next diff hides the real change behind a hundred reflowed lines. Whichever wrap convention you pick, pick one.

What the preview does and does not render

It uses markdown-it with GitHub Flavored Markdown extensions, so it lands very close to GitHub without being identical.

RendersDoes not
Tables, task lists, strikethroughGitHub alerts (> [!NOTE])
Fenced code with highlightingMermaid diagrams, without an extension
Raw HTML, sanitisedEmoji shortcodes like :tada:
Front matter, hiddenThe contents dropdown GitHub generates
Relative links between filesFootnotes, in older versions

Extensions worth the install

Markdown All in One. The one that matters for writing rather than reading: Ctrl+B and Ctrl+I for emphasis, automatic list renumbering, a generated and maintained table of contents, and table formatting on save. Built-in support covers preview; this covers typing.

markdownlint. Catches the structural mistakes that are invisible until something else renders the file — heading levels that skip, inconsistent list markers, missing blank lines around fences. Worth it on any repository with more than a handful of documents, and it pairs with a formatter for the things it only complains about.

Paste Image, or the built-in paste in recent versions. Pasting an image into a Markdown file writes the file into the workspace and inserts the link, which is otherwise a four-step manual job.

What is not usually worth it: a second preview extension. The built-in one is good, and running two means two answers to "what does this look like".

Exporting to PDF

There is no built-in export. The extensions that do it launch a headless browser and print, which works well and is a large dependency for an occasional job.

If you would rather not install one, export from here — same browser print engine, no install, and the document stays on your machine because the conversion happens in the tab rather than on a server. Useful too when the file is not in a workspace, or you are on a machine without your setup.

A few things that are already there

Common questions

How do I preview Markdown in VS Code?
Ctrl+K then V opens the preview beside the file, which is the one worth learning. Ctrl+Shift+V opens it in place of the editor. On a Mac, Cmd instead of Ctrl. Nothing needs installing — the preview is built in.
Why do my single line breaks disappear in the preview?
Because that is standard Markdown: one newline joins lines into a paragraph. GitHub comments break on every newline, which is why the preview and a GitHub comment can disagree. Set "markdown.preview.breaks" to true to match GitHub — but the file will still render the standard way elsewhere.
Does the VS Code preview match GitHub?
Closely, not exactly. It uses markdown-it with GitHub Flavored Markdown extensions, so tables, task lists and strikethrough work. Alerts, Mermaid diagrams, emoji shortcodes and the contents dropdown are GitHub features that need an extension or do not exist here.
Is Markdown All in One worth installing?
For anything more than occasional editing, yes. It adds keyboard shortcuts for bold and italic, automatic list renumbering, a generated table of contents, and table formatting. The built-in support covers preview and basic editing; this covers writing.
How do I export Markdown to PDF from VS Code?
There is no built-in export — it needs an extension, most of which launch a headless browser to print. If you would rather not install one, paste the Markdown into this site and export from there. Both routes use a browser print engine, so the output is comparable.
How do I stop the formatter mangling my Markdown?
Set a per-language default formatter in settings so Markdown files are not handled by whatever formats your code. If Prettier is reflowing paragraphs you did not want reflowed, set "proseWrap" to preserve.