2 def self.new(format, text)
4 when "html"; HTML.new(text || "")
5 when "markdown"; Markdown.new(text || "")
11 include ActionView::Helpers::TextHelper
12 include ActionView::Helpers::TagHelper
15 linkify(sanitize(simple_format(self)))
25 Sanitize.clean(text, Sanitize::Config::OSM).html_safe
30 Rinku.auto_link(text, :urls, tag_options(:rel => "nofollow")).html_safe
32 Rinku.auto_link(text, :urls, tag_options(:rel => "nofollow"))
37 class Markdown < String
39 html_parser.render(self).html_safe
49 @@html_renderer ||= Redcarpet::Render::XHTML.new({
50 :filter_html => true, :safe_links_only => true
52 @@html_parser ||= Redcarpet::Markdown.new(@@html_renderer, {
53 :no_intra_emphasis => true, :autolink => true, :space_after_headers => true