I’ve just upgraded who-needs-wp to use Kramdown instead of RDiscount. I started using Kramdown for 2 reasons; It’s written entirely in Ruby; and it adds some useful extensions to Markdown.

Pure Ruby

Kramdown is written entirely in Ruby. It is easier to install pure Ruby extensions with my hosting provider, Dreamhost, than use native extensions. RDiscount is a Ruby binding to the C Discount library, which makes it fast compared to the pure Ruby alternative. Since HTML files generated by who-needs-wp are created at intervals, and not generated per request, the speed of execution is not critical.

Extended syntax

Tables

Kramdown allows you to embedd tables within Markdown using the line character |. For example the following:

|---
|Heading 1|Heading 2|
|---
|Column 1|Column 2|
|Column 2|Column 2|
|===
|Footer {.markdown}

Generates the following table:

Heading 1 Heading 2
Column 1 Column 2
Column 2 Column 2
Footer  

Notice how the --- and === denote the header and footer of the table respectively.

Syntax highlighting

Previously who-needs-wp used MakersMark to provide syntax highlighting. This in turn used the Python pygments library which supports a wide range of languages. MakersMark allows you to mark code segments using @@@ ruby. Kramdown uses {: lang='ruby'} at the end of a code block. For example the following:

    puts "Hello World"
{: lang='ruby'}

generates the following:

puts "Hello World"

Kramdown doesn’t support as wider range of languages as MakersMark and Pygments. It uses the Coderay syntax highlighter, which is entirely written in Ruby. Unfortunately Coderay doesn’t have Bash syntax highlighting so some of my blog posts are dull and boring - but maybe syntax highlighting has nothing to do with that. ;-)