# Comments for a blog

**URL:** <https://www.ruby-forum.com/t/comments-for-a-blog/56214>\
**Category:** Rails\
**Created:** [March 29, 2006, 4:35am UTC](https://www.ruby-forum.com/t/comments-for-a-blog/56214 "2006-03-29T04:35:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Hernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@Daniel\_Hernandez](https://www.ruby-forum.com/u/Daniel_Hernandez)\
**Post date:** [March 29, 2006, 4:35am UTC](https://www.ruby-forum.com/t/comments-for-a-blog/56214/1 "2006-03-29T04:35:33Z")

</div>

Hello,

I’m making a blog and I need some function that convert the text  
writed for a user in a textarea into a formated text.  
I think to use h, but it forget paragraph breaks and I  
like allow some tags.

By  
Daniel

---

<div class="post-metadata">

**Author:** ![Daniel\_Hernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@Daniel\_Hernandez](https://www.ruby-forum.com/u/Daniel_Hernandez)\
**Post date:** [March 29, 2006, 4:38am UTC](https://www.ruby-forum.com/t/comments-for-a-blog/56214/2 "2006-03-29T04:38:54Z")

</div>

I like Redcloth:  
[http://whytheluckystiff.net/ruby/redcloth/](http://whytheluckystiff.net/ruby/redcloth/)

---

<div class="post-metadata">

**Author:** ![Daniel\_Hernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@Daniel\_Hernandez](https://www.ruby-forum.com/u/Daniel_Hernandez)\
**Post date:** [March 29, 2006, 4:39am UTC](https://www.ruby-forum.com/t/comments-for-a-blog/56214/3 "2006-03-29T04:39:26Z")

</div>

I use RedCloth w/ h.

RedCloth.new(h comment).to\_html

This will sanitize via h, and then convert textile commands to HTML.

---

<div class="post-metadata">

**Author:** ![Daniel\_Hernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@Daniel\_Hernandez](https://www.ruby-forum.com/u/Daniel_Hernandez)\
**Post date:** [March 29, 2006, 4:42am UTC](https://www.ruby-forum.com/t/comments-for-a-blog/56214/4 "2006-03-29T04:42:20Z")

</div>

On Tue, 28 Mar 2006, Rabbit wrote:

> I like Redcloth:  
> [http://whytheluckystiff.net/ruby/redcloth/](http://whytheluckystiff.net/ruby/redcloth/)

But in redcloth a user can insert tags that I don’t want allow.

---

<div class="post-metadata">

**Author:** ![Daniel\_Hernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@Daniel\_Hernandez](https://www.ruby-forum.com/u/Daniel_Hernandez)\
**Post date:** [March 29, 2006, 1:24pm UTC](https://www.ruby-forum.com/t/comments-for-a-blog/56214/5 "2006-03-29T13:24:53Z")

</div>

Le Mercredi 29 Mars 2006 04:34, Daniel Hernandez a Ã©critÂ :

> Hello,

Hello,

> I’m making a blog and I need some function that convert the text  
> writed for a user in a textarea into a formated text.  
> I think to use h, but it forget paragraph breaks and I  
> like allow some tags.

You can use simple\_format, see :  
[http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M000510](http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M000510)

Bye.

---

<div class="post-metadata">

**Author:** ![Daniel\_Hernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@Daniel\_Hernandez](https://www.ruby-forum.com/u/Daniel_Hernandez)\
**Post date:** [March 29, 2006, 5:00am UTC](https://www.ruby-forum.com/t/comments-for-a-blog/56214/6 "2006-03-29T05:00:26Z")

</div>

On Tue, 28 Mar 2006, Michael G. wrote:

> I use RedCloth w/ h.
> 
> RedCloth.new(h comment).to\_html
> 
> This will sanitize via h, and then convert textile commands to HTML.

But it has two problems:

1. I like allow some tags like 
```
but h sanitize it.
```
2. I don’t like allow some ReCloth’s tags like h1.

---

<div class="post-metadata">

**Author:** ![Daniel\_Hernandez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@Daniel\_Hernandez](https://www.ruby-forum.com/u/Daniel_Hernandez)\
**Post date:** [March 29, 2006, 1:57pm UTC](https://www.ruby-forum.com/t/comments-for-a-blog/56214/7 "2006-03-29T13:57:54Z")

</div>

I use this: [http://blog.ideoplex.com/2005/03/17.html](http://blog.ideoplex.com/2005/03/17.html)
