# Text format - show breaks

**URL:** <https://www.ruby-forum.com/t/text-format-show-breaks/117407>\
**Category:** Rails\
**Created:** [October 16, 2007, 5:17pm UTC](https://www.ruby-forum.com/t/text-format-show-breaks/117407 "2007-10-16T17:17:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [October 16, 2007, 5:17pm UTC](https://www.ruby-forum.com/t/text-format-show-breaks/117407/1 "2007-10-16T17:17:45Z")

</div>

How do I make a post to a blog format with the same breaks the user  
added?

for example:

the user typed in:

'Hello

This is a post’

And my output is like this:

‘Hello This is a post’

How do I format it with the correct breaks?

Thanks

---

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [October 16, 2007, 5:25pm UTC](https://www.ruby-forum.com/t/text-format-show-breaks/117407/2 "2007-10-16T17:25:01Z")

</div>

On Tue, 2007-10-16 at 17:17 +0200, David M. wrote:

> And my output is like this:
> 
> ‘Hello This is a post’
> 
> How do I format it with the correct breaks?

simple\_format

–  
Tore D.  
removed\_email\_address@domain.invalid  
Trondheim, NO  
[http://tore.darell.no/](http://tore.darell.no/)

---

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [October 16, 2007, 5:32pm UTC](https://www.ruby-forum.com/t/text-format-show-breaks/117407/3 "2007-10-16T17:32:39Z")

</div>

Will simple\_format protect from embedded nasty html?

---

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [October 16, 2007, 5:36pm UTC](https://www.ruby-forum.com/t/text-format-show-breaks/117407/4 "2007-10-16T17:36:47Z")

</div>

On Tue, 2007-10-16 at 10:31 -0500, Michael G. wrote:

> Will simple\_format protect from embedded nasty html?

No, you need h() in addition to it: simple\_format(h(text))

–  
Tore D.  
removed\_email\_address@domain.invalid  
Trondheim, NO  
[http://tore.darell.no/](http://tore.darell.no/)
