Opinionated Programmer - Jo Liss's musings on enlightened software development.

markdown-rails: Markdown for your views and partials

In my Rails apps, I have a lot of static prose, and that prose tends to be written in HTML. As a result, it’s cumbersome to edit.

Markdown would be much better suited for prose. However, Rails does not support .html.md views out of the box.

As described by @tjwallace, there is a simple workaround – use HAML’s :markdown filter:

  **Markdown** goes here.

  The time is #{Time.now}.

Still, this leaves your Markdown files indented. I thought there is no reason why Rails shouldn’t support plain .html.md files.

So I wrote up a simple markdown-rails gem. Check it out:


One shortcoming is, it doesn’t support embedded Ruby code (like HAML’s :markdown filter with #{exp}). I’d love to add this at some point, but I’m not sure about the best approach. See the comments and the Limitations section in the README.