# Anybody use Red|Blue Cloth?

**URL:** <https://www.ruby-forum.com/t/anybody-use-red-blue-cloth/77545>\
**Category:** Rails\
**Created:** [March 7, 2006, 1:30am UTC](https://www.ruby-forum.com/t/anybody-use-red-blue-cloth/77545 "2006-03-07T01:30:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [March 7, 2006, 1:30am UTC](https://www.ruby-forum.com/t/anybody-use-red-blue-cloth/77545/1 "2006-03-07T01:30:41Z")

</div>

Does anybody use and prefer Redcloth (or bluecloth, which appears to be  
alpha)? Does it affect performance much? Is there a way to get it to  
automatically process templates without having to call textilize?

Thanks,  
Joe

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [March 7, 2006, 3:02am UTC](https://www.ruby-forum.com/t/anybody-use-red-blue-cloth/77545/2 "2006-03-07T03:02:41Z")

</div>

Joe - I use redcloth all the time for my projects. It gives my users  
and easy way to mark up my documents / comments (my site, AreYouHiring  
[http://www.areyouhiring.com](http://www.areyouhiring.com)) without having to worry about HTML. In  
fact, it seems safer - I can filter out pure html from the content by  
using “h”, and then render what’s left via RedCloth.

I don’t see performance issues yet, but I plan to implement caching to  
cover that.

I simple do something like this in a helper:

RedCloth.new(body).to\_html to render my text.  
Hope this helps somewhat.

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [March 7, 2006, 3:44am UTC](https://www.ruby-forum.com/t/anybody-use-red-blue-cloth/77545/3 "2006-03-07T03:44:53Z")

</div>

Joe wrote:

> Does anybody use and prefer Redcloth (or bluecloth, which appears to be  
> alpha)? Does it affect performance much? Is there a way to get it to  
> automatically process templates without having to call textilize?

I use RedCloth–which is more flexible. Overhead is negligible. As to  
auto formatting, not really–unless you want to store the processed  
version of your text in the database.

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [March 7, 2006, 5:06pm UTC](https://www.ruby-forum.com/t/anybody-use-red-blue-cloth/77545/4 "2006-03-07T17:06:55Z")

</div>

I like Bluecloth myself simply because I prefer the Markdown syntax. I  
have  
been using it as part of Typo and it works well, I have not encountered  
any  
issues thus far.

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [March 7, 2006, 5:22pm UTC](https://www.ruby-forum.com/t/anybody-use-red-blue-cloth/77545/5 "2006-03-07T17:22:10Z")

</div>

Tangent to this topic – has anyone found a good pattern to using  
truncate  
and textilize together? Perhaps have written a  
smart\_truncate\_and\_textilize  
helper? Calling truncate after the textilize leaves the possibility of  
unclosed or interrupted HTML tags, running truncate prior to textilize  
can  
result in textile markup being rendered.

Thanks!

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [March 8, 2006, 8:57pm UTC](https://www.ruby-forum.com/t/anybody-use-red-blue-cloth/77545/6 "2006-03-08T20:57:24Z")

</div>

Is there a way to use RedCloth in a controller? I can get it to work  
fine in views. Something like:

def view  
RedCloth.new(response).to\_html  
end

Joe

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [March 25, 2006, 5:32am UTC](https://www.ruby-forum.com/t/anybody-use-red-blue-cloth/77545/7 "2006-03-25T05:32:33Z")

</div>

On 3/7/06, D. Taylor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Tangent to this topic – has anyone found a good pattern to using truncate  
> and textilize together? Perhaps have written a smart\_truncate\_and\_textilize  
> helper? Calling truncate after the textilize leaves the possibility of  
> unclosed or interrupted HTML tags, running truncate prior to textilize can  
> result in textile markup being rendered.
> 
> Thanks!

I use close\_open\_html(truncate(markdown(the\_text), 200)) with the  
close\_open\_html routine found here:  
[http://blog.ideoplex.com/2005/03/17.html](http://blog.ideoplex.com/2005/03/17.html). I renamed “sanitize” to  
“close\_open\_html” because I thought that it was more descriptive.

Sincerely,

Tom L.  
[http://AllTom.com/](http://AllTom.com/)  
[http://GadgetLife.org/](http://GadgetLife.org/)
