md2pdf simplifies the process of turning Markdown formatted text documents into print-ready PDF files without the need to go through an intermediate HTML phase. The command natively, and in pure Ruby, parses the Markdown document and uses Prawn to directly generate a correctly formatted PDF.
Prawn is the fastest pure Ruby PDF generation library available. It really is pretty cool and takes most of the ouch out of generating print-ready documents.
md2pdf is part of my markdown_prawn project and is released as a RubyGem.
You can install it using the following:
$ [sudo] gem install prawn --pre markdown_prawn --pre
An executable script md2pdf will be installed on your system’s path ready to be run.
It accepts no arguments, and instead expects a Markdown document to be passed to it on Standard In and it will render a PDF Document to Standard Out.
$ md2pdf < test.md > test.md.pdf
If you call md2pdf with no redirected or piped input, you will be able to key markdown directly into the tool, terminate your input with CTRL+D and it will render what you have entered as a PDF.
md2pdf is under active development, but not all of the Markdown specification is implemented. Some parts of it (such as dealing with inline HTML) may never be supported.
md2pdf (markdown_prawn) is released under a Creative Commons, Share Alike by Attribution No Commercial (Scotland) licence. Patches and all contributions are welcome, please see the HACKING page for more details.