Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

BSP's avatar
Level 1

Blade - Displaying Unescaped Html

I have a string of HTML coming from the controller, and I'm trying to render it unescaped in the blade template. The {{!! $variable !!}} method works - in the sense that it renders the html unescaped, but it adds an extra curly brace at the top and another one at the bottom of the html:

{
My title - looking normal
The text which looks fine and nicely formatted
}

if I don't use the double exclamation mark and I render the variable like so: {{ $variable }} then the output is

<h1>My title - looking normal</h1>
<p>The text which looks fine and nicely formatted</p>

So all looks normal, and the curly brace is not in that variable. It must mean that the curly braces are rendered because of the !! !! but have no clue how to prevent it

0 likes
3 replies
BSP's avatar
Level 1

Hi, I updated the post to better reflect what the code and result looks like.

When I try to render the html unescaped by using this:

{{!! $event->description !!}}

The output is this:

<div style="height: 400px; overflow-y: scroll;">
                                
{
<h1>This is the title</h1>
<p><br>
Paragraph of text</p>
}

</div>

But when I render the variable like this:

{{ $event->description }}

the output is this

<div style="height: 400px; overflow-y: scroll;">
<h1>This is the title</h1> <p><br /> Paragraph of text</p> 
</div>

BSP's avatar
BSP
OP
Best Answer
Level 1

Nevermind, I'm being silly. The unescaped syntax has single curly braces. I used double curly braces :|

Thanks for the fast reply InspiredPrynce!

Please or to participate in this conversation.