This post reviews several methods for converting a Markdown (.md) formatted file to PDF, from UNIX or Linux machines.
$ pandoc How_I_got_svg-resizer_working_on_Mac_OSX.md -s -o test1.pdf
http://superuser.com/questions/689056/how-can-i-convert-github-flavored-markdown-to-a-pdf I've had success using grip to display markdown in Chrome and then use Chrome's "Save as PDF" option in the Print dialog.
pip install grip
grip your_markdown.md
grip
will render the markdown on localhost:5000 ... - just edit away and refresh the browser. Print when ready.
This gave a more reliable representation than pandoc
and was lighter weight than installing LaTeX (required by pandoc for pdf generation).
The print is not command line in this answer, but still found this easier/more reliable (looked 100% like Github for a long document including relatively linked images and code highlighting).
http://superuser.com/questions/689056/how-can-i-convert-github-flavored-markdown-to-a-pdf You can also use Node.js based markdown-pdf
npm install -g markdown-pdf
markdown-pdf /path/to/markdown
The GRIP results look just like GitHub README pages. The Pandoc result looks like (is) LaTex format. And the Node.js result is the most original looking, but slightly harder to read than GRIP output PDF. Overall, I prefer GRIP output.
Hi @brilliant-ember, did you solve this on your machine? If not, please post the a1.md file so I can test with it. Thanks.
Actually,
markdown-pdf
is currently not working on my new macOS machine. I get the now well-knownHighlight.js
v9 EOL error that follows:Apparently,
markdown-pdf
needs to be updated to useHighlight.js
v10+. If anyone is aware of additional issues/threads relevant to this, please pass them along.For now, I would suggest sticking to
pandoc
orgrip
for Markdown to PDF conversions from the command line interface.However, one new, non-command-line option from earlier this year that I have not tested yet is the Markdown Viewer extension for Google Chrome and Mozilla Firefox. Find it on GitHub here (from @simov). Seems worth trying.
~J