---
title: "Comment by Mark Snape on \"How to keep line breaks in user input without unescaping it in Laravel\" | Hashnode"
description: "I try to use CSS, but failing that, my preferred pattern is { ! ! nl2br(e($description)) ! ! } the e() function escapes the content, then you convert the newlin"
url: "https://hashnode.com/posts/how-to-keep-line-breaks-in-user-input-without-unescaping-it-in-laravel/6291f5b70989e6b52feaf0f1/comment/629a929d70302328c80b63bb"
---

[Discussion](https://hashnode.com/posts/how-to-keep-line-breaks-in-user-input-without-unescaping-it-in-laravel/6291f5b70989e6b52feaf0f1)

Comment [How to keep line breaks in user input without unescaping it in Laravel](https://hashnode.com/posts/how-to-keep-line-breaks-in-user-input-without-unescaping-it-in-laravel/6291f5b70989e6b52feaf0f1)

[Mark Snape](https://hashnode.com/@Snapey)

[Jun 3, 2022](https://hashnode.com/posts/how-to-keep-line-breaks-in-user-input-without-unescaping-it-in-laravel/6291f5b70989e6b52feaf0f1/comment/629a929d70302328c80b63bb)

I try to use CSS, but failing that, my preferred pattern is

```
{!! nl2br(e($description)) !!}
```

the e() function escapes the content, then you convert the newlines and finally, safely echo the raw content
