I also write it in Vim, but a script turns a kind of markdown derivative of mine into HTML, inserts it into a template, which in turn is converted to PDF by Chrome.
I have most of the bugs sorted out, which fonts work fine and render selectable text, how to deal with a single pixel white line in a full page background image, etc. It works, but it's an ugly hack. I'm dreaming of writing my own PostScript someday. From my initial research, it seems to be not that hard really.
Postscript is actually really easy. The language itself is RPN based (like the older HP calculators) and really fun to work with. Grab a copy of the "Blue Book" (do a google search for Postscript Blue Book and it should be one of the first links) -- it has a lot of good examples and exercises in it. Should take about a good weekend to get the feel for it, then just keep a copy of the function reference from the end of the book printed out.
For rendering markdown straight into PDF (and other formats), have a look at pandoc, it's really powerful. If you can make your markdown flavour compatible with (or a superset of) pandoc markdown it should be simple. See RMarkdown for inspiration.
I have most of the bugs sorted out, which fonts work fine and render selectable text, how to deal with a single pixel white line in a full page background image, etc. It works, but it's an ugly hack. I'm dreaming of writing my own PostScript someday. From my initial research, it seems to be not that hard really.