Textilize != RedCloth.new?

For me, textilize(stuff) produces nasty stuff -
's instead of
enclosing

's and some closing <h*>'s are missing. RedCloth.new(stuff)
works fine though. Isn’t textilize supposed to produce the same output?
Or do I need to tweak something?

Joe

If you look at the source of textilize, you’ll see it forces hard
breaks.

File vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb,

line 84
84: def textilize(text)
85: if text.blank?
86: “”
87: else
88: textilized = RedCloth.new(text, [ :hard_breaks ])
89: textilized.hard_breaks = true if
textilized.respond_to?(“hard_breaks=”)
90: textilized.to_html
91: end
92: end

You can either re-define textilize however you want or create a new
helper that does what you want.
I agree that it was a bad idea for them to make it use hard breaks, but
it’s what we’ve got. The beauty of Rails is you can always override
anything you don’t like.

Joe wrote:

For me, textilize(stuff) produces nasty stuff -
's instead of
enclosing

's and some closing <h*>'s are missing. RedCloth.new(stuff)
works fine though. Isn’t textilize supposed to produce the same output?
Or do I need to tweak something?

Joe

Ah. I wonder if that (:hard_breaks) could be set in environment.rb.

Joe