def textilize(text, *flags)
      require 'RedCloth'

      if flags.include?(:safe)
        raise ArgumentError, 'The :safe flag has been removed. Mark the input HTML safe instead or downgrade to Formatize 1.x'
      end

      text = sanitize(text) unless text.html_safe?

      if text.blank?
        ""
      else
        RedCloth.new(text, flags).to_html
      end.html_safe
    end
def textilize(text, *flags)
      require 'RedCloth'

      if flags.include?(:safe)
        raise ArgumentError, 'The :safe flag has been removed. Mark the input HTML safe instead or downgrade to Formatize 1.x'
      end

      text = sanitize(text) unless text.html_safe?

      if text.blank?
        ""
      else
        RedCloth.new(text, flags).to_html
      end.html_safe
    end
Accepts a string of Textile {http://redcloth.org/textile} and one or
 more flags. Often, the default behavior will be suitable and you will not
 have to pass it any flags:

   textilize("*This is Textile!*  Rejoice!")
   # => "<p><strong>This is Textile!</strong>  Rejoice!</p>"

 When necessary, flags are listed as such:

   textilize("(snip)", :flag1, :flag2, :flag3)
   # => "(snip)"

 The +RedCloth+ documentation {http://redcloth.rubyforge.org/classes/RedCloth/TextileDoc.html}
 lists the available flags.

 It sanitizes the input using Rails' +sanitize+ prior to parsing.
 There are two ways to bypass pre-parsing sanitization:

 1. Pass a string that has been marked HTML safe. (Preferred).
 2. Use the special <tt>:safe</tt> flag, which is not passed on to the
    parser. _(Deprecated in 1.1, removed in 2.0)._