Multimarkdown to PDF

As I begin to write longer pieces again, after too long a hiatus, I find myself again not wanting to trust my work entirely to Word. I am not a knee-jerk Microsoft hater, or even one to complain about the bloat in Word. Word is great for any number of things, but it’s not so great at keeping things simple and it’s not so great at being able to have multiple outputs from a single file.

Working with a text editor like [Textmate][tm] has shown me how working with plain text formatted using something like Fletcher Penney’s [Multimarkdown][mmd] means I can not only output to HTML, RTF, DOC, and even PDF, but that I can do so using my own style sheets. (And, yes, I fiddled a bit over the last day or two with going through LaTeX, which produces beautiful output but is far too complicated for me.) The ability to produce PDF output is especially welcome, and the fact that I finally got not only an install of [PrinceXML][pxml] working but I also got a working adaptation of a Textmate command to automate the process is a *huge* step forward for me.

Again with thanks to Fletcher Penney, I adapted the syntax for the convert to Word DOC:

# Process the MultiMarkdowndocument and convert to PDF using PrinceXML

# first figure out a name for the result
NAME=”${TM_FILENAME:-untitled}”
BASENAME=”${NAME%.*}”
DST=”/tmp/$BASENAME”

#cd “${TM_MULTIMARKDOWN_PATH:-~/Library/Application Support/MultiMarkdown}”
cd “${TM_MULTIMARKDOWN_PATH:-$HOME/Library/Application Support/MultiMarkdown}”
cd bin

./multimarkdown2XHTML.pl > “$DST.html”

# Get all this to Prince
require_cmd prince
prince “$DST.html”

open “$DST.pdf”

[tm]: http://macromates.com/ “Home of Textmate”
[mmd]: http://fletcherpenney.net/multimarkdown/ “Multimarkdown’s Home Page”
[pxml]: http://www.princexml.com/

Leave a Reply