ruby-on-railsmarkdownredcloth

Rails) What Markdown Should I Use Now?


I need the following features:

  1. hard-wrap text
  2. auto link (make urls into clickable links)
  3. @name should turn into links to user/show action (I should be able to write this helper method)
  4. prevent code injection

As far as I've learned, redcarpet doesn't seem to work properly, and I found redcloth to be the choice. But it seems a little outdated, and it doesn't provide filter_html or autolink options. I could install gems sanitize and autolink to use with redcloth but I believe there would be a better way.

Can anyone give me suggestions?


Solution

  • I'd recommend checking out the html-pipeline gem. It has filters for doing a lot of what you want and includes: