How to keep line breaks in user input without unescaping it in Laravel
The problem
I recently got a question from a client about disappearing line breaks. It was a valid question since the text came from a textarea input that was echoed out on a page. The type of content was really simple and had no need for markup, so ...
stefrouschop.nl3 min read
Mark Snape
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