module Stringex::StringExtensions::PublicInstanceMethods

def to_html(lite_mode = false)

from RedCloth.
except that it makes RedCloth do all the work instead of just gsubbing the return
This is roughly equivalent to ActionView's textilize_without_paragraph
P element, which is useful behavior for generating header element text, etc.
Using :lite argument will cause RedCloth to not wrap the HTML in a container

or self [with a friendly warning] if Redcloth is not available.
Returns the string converted (via Textile/RedCloth) to HTML format
def to_html(lite_mode = false)
  if defined?(RedCloth)
    if lite_mode
      RedCloth.new(self, [:lite_mode]).to_html
    else
      if self =~ /<pre>/
        RedCloth.new(self).to_html.tr("\t", "")
      else
        RedCloth.new(self).to_html.tr("\t", "").gsub(/\n\n/, "")
      end
    end
  else
    warn "String#to_html was called without RedCloth being successfully required"
    self
  end
end