Use RedCloth 2 for sane linebreaking in Textile and how to install on shared hosting 4
It seems like logical enough behavior – you just want what was entered into the textarea to be represented in the most logical manner in the markup.
This:
A paragraph Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean suscipit metus vitae magna. Phasellus euismod ultrices justo.
Another paragraph Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean suscipit metus vitae magna. Phasellus euismod ultrices justo.
This paragraph
has linebreaks
though
to become this:
<p>A paragraph...</p>
<p>Another paragraph...</p>
<p>This paragraph<br/>
has linebreaks<br/>
though</p>
Unfortunately, this isn’t how it works in RedCloth 3. These are your two options
without :hardbreaks on
<p>A paragraph...</p>
<p>Another paragraph...</p>
<p>This paragraph
has linebreaks
though</p>
with hardbreaks on
<p>A paragraph...<br>
Another paragraph...<br>
This paragraph<br>
has linebreaks<br>
though<br>
</p>
Which means there is no way to get that right spacing (multiple returns where ignored in my testing), much less the markup you want: paragraphs with possibility of linebreaks in them.
The only way I found around this was by installing the latest RedCloth 2. To avoid problems with this being superseded by a later version of RC3 (and to get around not being able to install gems) being installed on the host, you can drop it in vendor and specify a require with a version in environment.rb. If even this won’t work on your shared host, take out the require and just move the redcloth.rb to the root of the vendor folder and Bob’s yer uncle.
Update 04/10/2007
I found this in the Collaboa environment.rb. I haven’t tested it, myself, but it looks like it should work nicely for forcing the version you want.
# We want features from RedCloth trunk (> 3.0.4), so unload the RedCloth gem if any, and re-require
Object.send(:remove_const, :RedCloth) if Object.const_defined?(:RedCloth)
require "#{RAILS_ROOT}/vendor/redcloth/lib/redcloth"

Articles via rss or email
I just manually applied this patch to Redcloth in my application controller.
http://code.whytheluckystiff.net/redcloth/changeset/128
Why just hasn’t released another version since this revision; it looks like he’s working on SuperRedCloth.
Works like a charm for me.
I also just found a post on Why’s blog about SuperRedCloth – http://redhanded.hobix.com/inspect/superredclothAsAChild.html
I haven’t tried it yet, but will.
Thanks for the pointer, Trey.
Ya, I read about SRC, too, but he hasn’t gotten to the breaking option yet, based on the wiki, and based on the discussion in the post I don’t know that it works like the old RC2 behavior. I actually posted a comment supporting this style of breaking, but either his moderation is on with no feedback, or it doesn’t like Safari.
Actually, I had read the more recent blog post about SuperRedCloth where they discuss breaking, not that one.