This extension converts Markdown files to pdf, html, png or jpeg files.
Supports the following features
Sample files
INPUT
::: warning
*here be dragons*
:::
OUTPUT
<div class="warning">
<p><em>here be dragons</em></p>
</div>
INPUT
@startuml
Bob -[#red]> Alice : hello
Alice -[#0000FF]->Bob : ok
@enduml
OUTPUT

Include markdown fragment files: :[alternate-text](relative-path-to-file.md).
├── [plugins]
│ └── README.md
├── CHANGELOG.md
└── README.md
INPUT
README Content
:[Plugins](./plugins/README.md)
:[Changelog](CHANGELOG.md)
OUTPUT
Content of README.md
Content of plugins/README.md
Content of CHANGELOG.md
INPUT
```mermaid
stateDiagram
[*] --> First
state First {
[*] --> second
second --> [*]
}
```
OUTPUT

Chromium download starts automatically when Markdown PDF is installed and Markdown file is first opened with Visual Studio Code.
However, it is time-consuming depending on the environment because of its large size (~ 170Mb Mac, ~ 282Mb Linux, ~ 280Mb Win).
During downloading, the message Installing Chromium is displayed in the status bar.
If you are behind a proxy, set the http.proxy option to settings.json and restart Visual Studio Code.
If the download is not successful or you want to avoid downloading every time you upgrade Markdown PDF, please specify the installed Chrome or 'Chromium' with markdown-pdf.executablePath option.
F1 or Ctrl+Shift+Pexport and select below
markdown-pdf: Export (settings.json)markdown-pdf: Export (pdf)markdown-pdf: Export (html)markdown-pdf: Export (png)markdown-pdf: Export (jpeg)markdown-pdf: Export (all: pdf, html, png, jpeg)
markdown-pdf: Export (settings.json)markdown-pdf: Export (pdf)markdown-pdf: Export (html)markdown-pdf: Export (png)markdown-pdf: Export (jpeg)markdown-pdf: Export (all: pdf, html, png, jpeg)
"markdown-pdf.convertOnSave": true option to settings.jsonVisual Studio Code User and Workspace Settings
markdown-pdf.* settings
markdown-pdf.type"markdown-pdf.type": [
"pdf",
"html",
"png",
"jpeg"
],
markdown-pdf.convertOnSavemarkdown-pdf.convertOnSaveExclude"markdown-pdf.convertOnSaveExclude": [
"^work",
"work.md$",
"work|test",
"[0-9][0-9][0-9][0-9]-work",
"work\\test" // All '\' need to be written as '\\' (Windows)
],
markdown-pdf.outputDirectory\ need to be written as \\ (Windows)"markdown-pdf.outputDirectory": "C:\\work\\output",
Markdown file, it will be interpreted as a relative path from the filefolder, it will be interpreted as a relative path from the root folderworkspace, it will be interpreted as a relative path from the each root folder
"markdown-pdf.outputDirectory": "output",
~, it will be interpreted as a relative path from the home directory"markdown-pdf.outputDirectory": "~/output",
relative path, it will be created if the directory does not existabsolute path, an error occurs if the directory does not existmarkdown-pdf.outputDirectoryRelativePathFilemarkdown-pdf.outputDirectoryRelativePathFile option is set to true, the relative path set with markdown-pdf.outputDirectory is interpreted as relative from the filemarkdown-pdf.styles\ need to be written as \\ (Windows)"markdown-pdf.styles": [
"C:\\Users\\<USERNAME>\\Documents\\markdown-pdf.css",
"/home/<USERNAME>/settings/markdown-pdf.css",
],
Markdown file, it will be interpreted as a relative path from the filefolder, it will be interpreted as a relative path from the root folderworkspace, it will be interpreted as a relative path from the each root folder
"markdown-pdf.styles": [
"markdown-pdf.css",
],
~, it will be interpreted as a relative path from the home directory"markdown-pdf.styles": [
"~/.config/Code/User/markdown-pdf.css"
],
"markdown-pdf.styles": [
"https://xxx/markdown-pdf.css"
],
markdown-pdf.stylesRelativePathFilemarkdown-pdf.stylesRelativePathFile option is set to true, the relative path set with markdown-pdf.styles is interpreted as relative from the filemarkdown-pdf.includeDefaultStylesmarkdown-pdf.highlightmarkdown-pdf.highlightStyle"markdown-pdf.highlightStyle": "github.css",
markdown-pdf.breaksmarkdown-pdf.emojimarkdown-pdf.executablePath\ need to be written as \\ (Windows)"markdown-pdf.executablePath": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
markdown-pdf.scale"markdown-pdf.scale": 1
markdown-pdf.displayHeaderFooter"markdown-pdf.headerTemplate": "",
"markdown-pdf.footerTemplate": "",
markdown-pdf.headerTemplatemarkdown-pdf.displayHeaderFooter to true<span class='date'></span> : formatted print date. The format depends on the environment<span class='title'></span> : markdown file name<span class='url'></span> : markdown full path name<span class='pageNumber'></span> : current page number<span class='totalPages'></span> : total pages in the document%%ISO-DATETIME%% : current date and time in ISO-based format (YYYY-MM-DD hh:mm:ss)%%ISO-DATE%% : current date in ISO-based format (YYYY-MM-DD)%%ISO-TIME%% : current time in ISO-based format (hh:mm:ss)%%ISO-DATE%%"markdown-pdf.headerTemplate": "<div style=\"font-size: 9px; margin-left: 1cm;\"> <span class='title'></span></div> <div style=\"font-size: 9px; margin-left: auto; margin-right: 1cm; \">%%ISO-DATE%%</div>",
<span class='date'></span>"markdown-pdf.headerTemplate": "<div style=\"font-size: 9px; margin-left: 1cm;\"> <span class='title'></span></div> <div style=\"font-size: 9px; margin-left: auto; margin-right: 1cm; \"> <span class='date'></span></div>",
markdown-pdf.footerTemplate"markdown-pdf.footerTemplate": "<div style=\"font-size: 9px; margin: 0 auto;\"> <span class='pageNumber'></span> / <span class='totalPages'></span></div>",
markdown-pdf.printBackgroundmarkdown-pdf.orientationmarkdown-pdf.pageRanges"markdown-pdf.pageRanges": "1,4-",
markdown-pdf.format"markdown-pdf.format": "A4",
markdown-pdf.widthmarkdown-pdf.height"markdown-pdf.width": "10cm",
"markdown-pdf.height": "20cm",
markdown-pdf.margin.topmarkdown-pdf.margin.bottommarkdown-pdf.margin.rightmarkdown-pdf.margin.left"markdown-pdf.margin.top": "1.5cm",
"markdown-pdf.margin.bottom": "1cm",
"markdown-pdf.margin.right": "1cm",
"markdown-pdf.margin.left": "1cm",
markdown-pdf.quality"markdown-pdf.quality": 100,
markdown-pdf.clip.xmarkdown-pdf.clip.ymarkdown-pdf.clip.widthmarkdown-pdf.clip.height// x-coordinate of top-left corner of clip area
"markdown-pdf.clip.x": 0,
// y-coordinate of top-left corner of clip area
"markdown-pdf.clip.y": 0,
// width of clipping area
"markdown-pdf.clip.width": 1000,
// height of clipping area
"markdown-pdf.clip.height": 1000,
markdown-pdf.omitBackgroundmarkdown-pdf.plantumlOpenMarkermarkdown-pdf.plantumlCloseMarkermarkdown-pdf.plantumlServerdocker run -d -p 8080:8080 plantuml/plantuml-server:jetty
plantuml/plantuml-server - Docker Hubmarkdown-pdf.markdown-it-include.enablemarkdown-pdf.mermaidServer.emoji {
height: 2em;
}
Using files.autoGuessEncoding option of the Visual Studio Code is useful because it automatically guesses the character code. See files.autoGuessEncoding
"files.autoGuessEncoding": true,
If you always want to output to the relative path directory from the Markdown file.
For example, to output to the "output" directory in the same directory as the Markdown file, set it as follows.
"markdown-pdf.outputDirectory" : "output",
"markdown-pdf.outputDirectoryRelativePathFile": true,
Please use the following to insert a page break.
<div class="page"/>
markdown-pdf.styles optionMIT
and