Export your Markdown preview from Visual Studio Code exactly as you see it (styles, images, etc) to an HTML file. Open the result in your browser to print, save as PDF, or share.
Features
Export Markdown Preview as HTML: Export the current Markdown preview (not just the raw Markdown) as a styled HTML file (WYSIWYG)
Embed Local Images: Include local images directly in the exported HTML by default, so the file is easier to share.
Cancel Export: The logic is non-deterministic since it relies any other extensions or customizations you may have that alter the markdown preview. There's a potential for problems, so you can cancel the export by clicking the status bar button.
Usage
Open a Markdown file and preview it (Ctrl+Shift+V or Cmd+Shift+V).
Click the Export Preview button in the preview title bar, or run the Markdown: Export Preview command from the Command Palette.
By default, the extension saves the HTML file to your system's temporary folder (e.g., C:\Users\<user>\AppData\Local\Temp\markdown-preview.html on Windows).
After export, use the notification actions to open the file in your browser, reveal it in your file explorer, or copy the saved file path.
Note!
If you already had a markdown preview open when you install or enable this extension, you'll need to close and re-open it or open another to make the menu option visible. From then on it should always be visible.
Commands
Markdown: Export Preview (markdown.exportPreview): Export the current Markdown preview as HTML.
markdownPreviewExport.embedLocalImages: Embed local images as data URIs in the exported HTML. Remote and existing data URI images are left unchanged. Defaults to true.
markdownPreviewExport.outputMode: Controls how exported HTML files are saved. Use temp for the system temporary folder, besideMarkdown to save next to the current Markdown file, or ask to choose each export location. Defaults to temp.
Limitations
Only exports the current preview. If the preview is not open, the command will not work.
When markdownPreviewExport.outputMode is temp, the exported HTML is saved to your system's temp directory using the same name and will be overwritten with each export.
How it works
The extension hooks into the Markdown preview rendering process, captures the fully rendered HTML (including styles and theme), and writes it to a temporary file. The method used isn't an official VS Code API, so it could break in future releases.
Release Notes
0.0.1
Initial release: Export Markdown preview as HTML, matching VS Code theme, with quick open in browser.