Markdown to PDF from VS Code, without markdown-pdf
The popular VS Code extension for Markdown-to-PDF ships with Chromium. That is a lot of disk and a long install for an output that looks like a screenshot of the editor. The browser converter gives you better defaults and no install.
The flow
- Open your
.mdfile in VS Code. ⌘A/Ctrl+Ato select all,⌘C/Ctrl+Cto copy.- Open md2document.com in any browser.
- Click in the editor pane and paste. Preview renders on the right.
- Pick a template and a design. Press
⌘E/Ctrl+Eto export.
Why this beats the extension
- No install. No 200MB Chromium download. No extension to keep updated. Works on a fresh machine, a Codespace, or a coworker's laptop.
- Real templates. Eleven document templates with sensible cover, ToC and numbering defaults. The extension exports whatever the preview shows.
- Real themes. Ten design presets and twelve font pairings, instead of inheriting your VS Code colour theme.
- DOCX from the same source. Switch the export toggle, ship a Word file instead.
Optional: a one-click VS Code task
Add this to .vscode/tasks.json in your repo:
{
"version": "2.0.0",
"tasks": [
{
"label": "Open md2document",
"type": "shell",
"command": "open https://md2document.com",
"windows": { "command": "start https://md2document.com" },
"linux": { "command": "xdg-open https://md2document.com" }
}
]
}Bind it to a keyboard shortcut in keybindings.json if you reach for it often. You still paste the Markdown manually - keeping the converter unable to consume URL parameters is a privacy choice, not an oversight.
Pairing this with the VS Code preview
Keep VS Code's built-in preview open while writing - it is fast and tight to the editor. Use the converter as the export step, not as the live preview. The browser preview is great for checking chrome (cover, ToC, page numbers, footer) before you hit Export.
Common questions
Why not just use the markdown-pdf extension?
It downloads a 200MB Chromium binary on first run, the output uses VS Code's preview CSS so it looks like an editor screenshot, and it has no concept of cover pages, ToC, themes or templates. For a quick personal note it works. For documents you send, it does not.
Can I trigger the converter from a VS Code task?
Yes - add a 'Convert to PDF' entry to .vscode/tasks.json that opens the converter in your default browser. You still paste the Markdown manually (the converter does not accept URL-passed text for privacy reasons).
Does this work with Markdown All in One?
Yes - Markdown All in One handles editing; this converter handles exporting. They are complementary, not overlapping.
What about WSL paths on Windows?
VS Code on Windows reads WSL files transparently. Open the .md file, copy, paste - no path translation required.
Related
- Markdown to PDF in Obsidian
- Markdown to PDF in Typora
- Markdown to PDF - the full converter guide.