Markdown PDF (Revived)Install • Features • Settings • Requirements • Upgrade Converts Markdown files to PDF or HTML from within VSCode. All rendering is local, with no external servers or telemetry. RequirementsA stable Chrome, Chromium, or Microsoft Edge installation is required for PDF export. HTML export does not require a browser. The extension detects supported browsers automatically at standard installation paths on macOS, Linux, and Windows. On WSL, install the browser inside the Linux distribution. To use a non-standard browser binary:
Restart VSCode after changing this setting. Getting StartedVS Code users can search for "Markdown PDF" in the Extensions panel or install from the VS Code Marketplace. VSCodium users should install from Open VSX. Manual install: Download the UsageCommand Palette
Right-click Menu
Auto-convert on Save
To exclude specific files from auto-convert, add filename patterns to Features
SettingsOutput
Styles
User-supplied
Sanitized
|
| Setting | Default | Description |
|---|---|---|
markdown-pdf.breaks |
false |
Treat newlines as <br> tags. |
markdown-pdf.emoji |
true |
Render emoji shortcodes. |
markdown-pdf.math |
true |
Enable KaTeX math rendering. |
| Setting | Default | Description |
|---|---|---|
markdown-pdf.displayHeaderFooter |
false |
Show header and footer in PDF output. |
markdown-pdf.headerTemplate |
(title + date) | HTML template for the PDF header. |
markdown-pdf.footerTemplate |
(page / total) | HTML template for the PDF footer. |
markdown-pdf.printBackground |
true |
Print background graphics. |
markdown-pdf.orientation |
"portrait" |
Page orientation: portrait or landscape. |
markdown-pdf.format |
"A4" |
Paper size: Letter, Legal, Tabloid, Ledger, A0–A6. |
markdown-pdf.margin.top |
"2cm" |
Top margin. Units: mm, cm, in, px. |
markdown-pdf.margin.bottom |
"2cm" |
Bottom margin. Units: mm, cm, in, px. |
markdown-pdf.margin.right |
"2.5cm" |
Right margin. Units: mm, cm, in, px. |
markdown-pdf.margin.left |
"2.5cm" |
Left margin. Units: mm, cm, in, px. |
markdown-pdf.timeout |
60000 |
Timeout in milliseconds for PDF export. Increase for large documents or slow machines. |
Header and footer templates support these tokens:
| Token | Value |
|---|---|
<span class='title'></span> |
Document title (frontmatter title: if set, otherwise filename) |
<span class='pageNumber'></span> |
Current page number |
<span class='totalPages'></span> |
Total pages |
%%ISO-DATE%% |
Date in YYYY-MM-DD format |
%%ISO-DATETIME%% |
Date and time in YYYY-MM-DD hh:mm:ss format |
%%ISO-TIME%% |
Time in hh:mm:ss format |
Mermaid Diagrams
Mermaid diagrams render locally. PDF export waits for each diagram to finish rendering before capture.
```mermaid
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[Do the thing]
B -->|No| D[Skip it]
C --> E[End]
D --> E
```
PlantUML has been removed. It sent diagram source to plantuml.com on each render. Use Mermaid for local diagram rendering.
Custom Containers
The markdown-it-container plugin wraps content in named <div> elements. Style them with a custom CSS file.
Input:
::: warning
*here be dragons*
:::
Output:
<div class="warning">
<p><em>here be dragons</em></p>
</div>
File Includes
Includes insert the contents of another Markdown file at the include site. Paths are relative to the file containing the include directive.
Syntax: :[display text](https://github.com/AUAggy/markdown-pdf-revived/blob/HEAD/relative-path-to-file.md)
Example:
:[Plugins](https://github.com/AUAggy/markdown-pdf-revived/blob/HEAD/plugins/README.md)
:[Changelog](https://github.com/AUAggy/markdown-pdf-revived/blob/HEAD/CHANGELOG.md)
The output contains the rendered content of each included file in sequence.
Includes are limited to 10 levels, detect circular references, and cannot leave the workspace by default. Set markdown-pdf.allowPathsOutsideWorkspace to true only for trusted cross-workspace files.
Page Breaks
Insert a page break with:
<div class="page"/>
Known Limitations
- A supported browser must be installed separately for PDF export. The extension does not bundle or download a browser.
- Online CSS URLs (e.g.,
https://example.com/styles.css) do not resolve reliably in PDF output. Prefer local stylesheet paths. - Inline
<style>elements are blocked. Use a workspace-local file throughmarkdown-pdf.styles.
Upgrade Notes
Version 3
- Move Markdown
<style>content to a trusted workspace-local CSS file configured throughmarkdown-pdf.styles. - Sanitized
style="..."attributes remain supported. - On WSL, install Chrome, Chromium, or Microsoft Edge inside the Linux distribution.
From yzane.markdown-pdf
Version 2 removed PlantUML, PNG/JPEG export, and automatic Chromium downloads. Use Mermaid for diagrams and install a supported browser for PDF export.
Remove settings that are no longer supported:
| Removed setting | Current behavior |
|---|---|
markdown-pdf.scale |
Fixed at 1. |
markdown-pdf.pageRanges |
Exports all pages. |
markdown-pdf.width, markdown-pdf.height |
Use markdown-pdf.format. |
markdown-pdf.includeDefaultStyles |
Default styles are always enabled. |
markdown-pdf.stylesRelativePathFile |
Style paths resolve from the source file, then the workspace root. |
markdown-pdf.outputDirectoryRelativePathFile |
Relative output paths resolve from the workspace root. |
markdown-pdf.StatusbarMessageTimeout, markdown-pdf.debug |
Removed. |
markdown-pdf.markdown-it-include.enable |
File includes are always enabled. |
Version 2 also changed the default syntax theme to github.css, disabled headers and footers by default, and increased the default margins. Local images, includes, and stylesheets are restricted to the workspace unless markdown-pdf.allowPathsOutsideWorkspace is enabled.
See CHANGELOG.md for the full release history.
License
MIT