Enabling Markdown on your apache webserver - redux

In a previous post I enabled previewing of Markdown formatted documents using the Text::Markdown perl module. However simple that module was to implement, it only implemented daringfireball markdown. Things at $WORK have ramped up the adoption of Markdown and the atrophied standard is not enough. So, I've had to find another renderer.

Started by looking at how GitHub renders markdown and found they use the Redcarpet gem. The examples in the documentation combined with the ruby-redcarpet Ubuntu package make this a pretty simple exercise in upgrading my Markdown renderer:
  1. Install the Redcarpet gem:

  2. apt-get install ruby-redcarpet

  3. Replace ye olde Markdown.cgi with new hotness Markdown.cgi

  4. #!/usr/bin/ruby
    require 'redcarpet'
    print "Content-type: text/html\n\n"
    markdown = Redcarpet::Markdown.new(
        :autolink => true,
        :fenced_code_blocks => true,
    puts markdown.render(File.read(ENV['PATH_TRANSLATED']))

  5. Start your browser, surf the docs!
UPDATE: I've updated my renderer for Markdown.

Ratings and Recommendations by outbrain