Redcarpet Is Stupid Simple

Nov 18, 2011

Adding markdown has been on my very long list of todos for this site. I recently rebuilt this site in just plain ‘ol rails. Partly because I thought it was the best system, but also so I can play. I really thought adding markdown support would be more difficult. I almost feel like I skipped something.

I went with Redcarpet and it’s as easy as storing the markdown in your database and making a few method calls in preparation for display.

Redcarpet.new(post.content).to_html.html_safe

Really. That’s it. I haven’t even tossed that in a helper yet. As always, that’s to Ryan Bates and Railscasts for a great intro.

Now to add live preview like Stack Overflow.

If you enjoyed this and would like to be notified the next time I write something, you can subscribe with your choice of RSS or Email.

I promise not to spam you and you can unsubscribe at anytime.

Also, here are some other items you might like longer longer:

or go see everything in the archive.