Quickly convert Markdown files to pdf
These days I try and use Markdown wherever possible to apply a basic level of formatting to text content, quickly and easily. The content for this Jekyll-based site is mostly written in Markdown. I use it for formatting template-based transactional emails, with Adam Pritchard’s Markdown Here Chrome extension. It’s also good for content creation in Statamic.
Adam’s written a Markdown Cheat Sheet and there are other guides for Markdown usage on Github and Stack Overflow.
A Very Useful Thing would be to quickly generate a pdf from a Markdown file (normally with file extension .md or .markdown). This would allow generation of an easily shareable, formatted text document in a simple text editor, without the requirement for something heavyweight like Microsoft Word. If you use Node on your local machine, it’s accomplishable using Alan Shaw’s markdown-pdf Node module as a standalone terminal program.
Install your local module globally:
Navigate to the directory in the command line containing your Markdown file, and generate the pdf using the Markdown converter:
That’s it.
Here’s an example of a Markdown text file:
And here’s what the resulting pdf looks like:
There are a number of configurable options, and of course the module can alternatively be called as part of a process on a server supporting Node.