Skip to content

Customizing helpers and views for the preview feature

Katherine G. Pe edited this page Aug 17, 2014 · 5 revisions
module ApplicationHelper
  require 'redcloth'
  require 'htmlentities'

  def to_html(m)
    coder = HTMLEntities.new
    m = coder.decode(m)
    m.tap do |md| 
       RedCloth.new(md, [:filter_html, :sanitize_html]).to_html
       md.html_safe
    end
  end

end
Clone this wiki locally