Wednesday, March 23, 2011

Blogging with Markdown

I haven't done much blogging lately, so most of the asciidoc esoteric syntax is gone from me. Meanwhile, I've been using Markdown on a couple of popular web sites. Markdown has come a long way since I first investigated a blogging markup language with code highlighting. There is now a Python module with the built-in CodeHilite extension. This post gave me the confidence that Markdown was ready for primetime.

Here's how I setup my new blogging solution with Markdown*:

  • Install Python 2.5+
  • Download Markdown source code
  • Download Pygments source code
  • Uncompress the Markdown directory
  • Uncompress the Pygments directory
  • From the Pygments directory, move the pygments and external sub-directories into the Markdown directory
  • Apply this patch to the Markdown source files so noclasses configuration is exposted and fenced_code is also highlighted (I'm bummed this patch isn't included in the downloaded source)
  • Download and install the jEdit syntax and Notepad++ syntax files

Now the following command will do the work**:

python markdown.py input.md -o html4 -x "codehilite(noclasses=True)" -x fenced_code -f output.html

I still have to manually create the blog post in Blogger, but then it's just a copy-paste of the html, and I'm done.

* I don't like installing Python modules because I rarely use them--hence the simple uncompressing and use in-place.

** Like with my previous blogging solution, I like the syntax CSS to be inline.

No comments:

Post a Comment