@ 21 Nov 09

Markdown to PDF convertion script

As you may already know, I really enjoy Markdown meta-language (Btw this website is written in markdown ;)).

I've been looking for a great solution to write PDF documents in markdown for a few months.

pandoc

One solution is pandoc, which converts markdown to postscript before printing it as PDF.

I consider the output quite ugly and didn’t suceed to make it look great enought the few times I tried it.

wkhtmltopdf

Then, I discover another great tool: wkhtmltopdf. This is an amazing stuff baby !

Thanks to the webkit engine, it render any (X)HTML/CSS page to PDF. Totally awesome :)

The quality is pretty good and processing does not require X11 :)

mkd2pdf

So I created a tiny shell script wrapper that takes a markdown file, processes to Xhtml, then processes it to PDF.

It is called mkd2pdf

Usage

     $ mkd2pdf inputfile <outputfile>  
 

<outputfile> is optional and would be guessed if needed
the stylesheet should be called style.css in the current directory

Debian repository

I packaged it for Debian. Instructions on http://debian.zecrazytux.net

Installation:

      # apt-get install mkd2pdf