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
Install Nodejs at first, download "10.13.0 LTS" for Mac.
$ which node /usr/local/bin/node $ node -v v10.13.0 $ which npm /usr/local/bin/npm $ npm -v 6.4.1
$ npm install markdown-pdf $ which markdown-pdf /Users/jun.aruga/node_modules/.bin/markdown-pdf $ markdown-pdf --version 9.0.0 $ markdown-pdf --help Usage: markdown-pdf [options] <markdown-file-path> Options: -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 README.md
Then README.pdf
is generated in the same directory with README.md
.
Does markdown-pdf
support GFM (Github Flavored Markdown) [4] ?
References
- [1] Stackoverflow: How to convert from markdown to pdf - Stack Overflow
- [2] markdown-pdf: GitHub - alanshaw/markdown-pdf: Markdown to PDF converter
- [3] Nodejs official site: https://nodejs.org/en/
- [4] GitHub Flavored Markdown Spec