Another Japan in the World

Jun Aruga's blog.

Convert Markdown file to PDF file on Mac

I was looking for how to covert from a Markdown file to PDF file.

After finding a Stackoverflow page [1], I found markdown-pdf [2].


Install Nodejs at first, download "10.13.0 LTS" for Mac.

$ which node

$ node -v

$ which npm

$ npm -v
$ npm install markdown-pdf

$ which markdown-pdf

$ markdown-pdf --version

$ markdown-pdf --help
Usage: markdown-pdf [options] <markdown-file-path>

  -V, --version                            output the version number
  <markdown-file-path>                     Path of the markdown file to convert
  -c, --cwd [path]                         Current working directory
  -p, --phantom-path [path]                Path to phantom binary
  -h, --runnings-path [path]               Path to runnings (header, footer)
  -s, --css-path [path]                    Path to custom CSS file
  -z, --highlight-css-path [path]          Path to custom highlight-CSS file
  -m, --remarkable-options [json-options]  Options to pass to remarkable
  -f, --paper-format [format]              "A3", "A4", "A5", "Legal", "Letter" or "Tabloid"
  -r, --paper-orientation [orientation]    "portrait" or "landscape"
  -b, --paper-border [measurement]         Supported dimension units are: "mm", "cm", "in", "px"
  -d, --render-delay [millis]              Delay before rendering the PDF
  -t, --load-timeout [millis]              Timeout before the page is rendered in case `page.onLoadFinished` isn't fired
  -o, --out [path]                         Path of where to save the PDF
  -h, --help                               output usage information

How to use

$ markdown-pdf

Then README.pdf is generated in the same directory with

Does markdown-pdf support GFM (Github Flavored Markdown) [4] ?