Skip to content

primos63/vscode-markdown-pdf

 
 

Repository files navigation

Markdown PDF

This extension convert Markdown file to pdf, html, png or jpeg file.

Japanease README

Features

Supports the following features.

Usage

Command Palette

  1. Open the Markdown file
  2. Press F1 or Ctrl+Shift+P
  3. Type pdf and select Convert Markdown to PDF

demo

Menu

  1. Open the Markdown file
  2. Right click and select Convert Markdown to PDF

demo

Auto convert

  1. Add "markdown-pdf.convertOnSave": true option to settings.json
  2. Restart Visual Studio Code
  3. Open the Markdown file
  4. Auto convert on save

Extension Settings

Visual Studio Code User and Workspace Settings

  1. Select File > Preferences > UserSettings or Workspace Settings
  2. Find markdown-pdf settings in the Default Settings
  3. Copy markdown-pdf.* settings
  4. Paste to the settings.json, and change the value

demo

Options

{
	// Enable Auto convert on save
	"markdown-pdf.convertOnSave": false,

	// Excluded file name of convertOnSave option
	"markdown-pdf.convertOnSaveExclude": [
		"^work",
		"work.md$",
		"work|test",
		"[0-9][0-9][0-9][0-9]-work",
		"work\\d"  // \d -> \\d. All '\' need to be written as '\\'.
	],

	// Output Directory
	"markdown-pdf.outputDirectory": "C:\\work",

	// A list of local paths to the stylesheets to use from the markdown-pdf
	"markdown-pdf.styles": [
		"C:\\Users\\<USERNAME>\\Documents\\markdown-pdf.css",  // OK (Windows)
		"C:\Users\<USERNAME>\Documents\markdown-pdf.css",      // N/A. All '\' need to be written as '\\'. (Windows)
		"C:/Users/<USERNAME>/Documents/markdown-pdf.css",      // OK (Windows)
		"/home/<USERNAME>/settings/markdown-pdf.css",          // OK
		".vscode\\markdown-pdf.css",                           // OK. Relative path (Windows)
		".vscode/markdown-pdf.css",                            // OK. Relative path
		"markdown-pdf.css.css"                                 // OK. Relative path
	],

	// Set the style file name. for example: github.css, monokai.css ...
	// fine name list : https://github.com/isagalaev/highlight.js/tree/master/src/styles
	// demo site : https://highlightjs.org/static/demo/
	"markdown-pdf.highlightStyle": "github.css",

	// Enable Syntax highlighting
	"markdown-pdf.highlight": true,

	// Enable line breaks
	"markdown-pdf.breaks": false,

	// Enable emoji. http://www.webpagefx.com/tools/emoji-cheat-sheet/
	"markdown-pdf.emoji": true,

	// Output format: pdf, html, png, jpeg
	"markdown-pdf.type": "pdf",

	// Only used for types png & jpeg
	"markdown-pdf.quality": 90,

	// Page Option. Page size: A3, A4, A5, Legal, Letter, Tabloid
	"markdown-pdf.format": "A4",

	// Page Option. portrait or landscape
	"markdown-pdf.orientation": "portrait",

	// Page Option. Border Top. units: mm, cm, in, px
	"markdown-pdf.border.top": "1.5cm",

	// Page Option. Border bottom. units: mm, cm, in, px
	"markdown-pdf.border.bottom": "1cm",

	// Page Option. Border right. units: mm, cm, in, px
	"markdown-pdf.border.right": "1cm",

	// Page Option. Border left. units: mm, cm, in, px
	"markdown-pdf.border.left": "1cm",

	// Header contents
	"markdown-pdf.header.contents": "",

	// Header height. units: mm, cm, in, px
	"markdown-pdf.header.height": "",

	// Footer contents
	"markdown-pdf.footer.contents": "<div style=\"text-align: center;\">{{page}}/{{pages}}</div>",

	// Footer height. units: mm, cm, in, px
	"markdown-pdf.footer.height": "0.8cm"

}

F.A.Q.

How can I change emoji size ?

  1. Add the following to your stylesheet which was specified in the markdown-pdf.styles.
.emoji {
  height: 2em;
}

0.1.8 (2018/02/21)

  • Add: Feature allowing use of PlantUML in a markdown document.

0.1.7 (2017/04/05)

  • Change: Display completion message on status bar #19
  • Add: markdown-pdf.convertOnSaveExclude option #16
  • Fix: broken code-blocks #18
  • Fix: Image path error #14
  • Update: markdown.css of the vscode
  • Update: dependencies packages

License

MIT

Special thanks

and

Packages

No packages published

Languages

  • JavaScript 70.2%
  • CSS 29.3%
  • HTML 0.5%