Paragraph 1

Paragraph 2

" And I want to embed this html using some rendering code alon" /> Paragraph 1

Paragraph 2

" And I want to embed this html using some rendering code alon" /> Paragraph 1

Paragraph 2

" And I want to embed this html using some rendering code alon"/>

How to prevent encoding of inner html text in Scalatags render

122 Views Asked by At

Say I have a string like this defined:

val inner = "<p>Paragraph 1</p><p>Paragraph 2</p>"

And I want to embed this html using some rendering code along these lines:

div(inner).render

How to I prevent encoding of the inner part? I want to yield the complete html structure as below:

<div><p>Paragraph 1</p><p>Paragraph 2</p></div>

And not:

 <div>&lt;p&gt;Paragraph 1&lt;/p&gt;&lt;p&gt;Paragraph 2&lt;/p&gt;</div>
1

There are 1 best solutions below

0
user79074 On

You need to use the raw function to prevent encoding. So the code should read:

div(raw(inner)).render