fefit/fet

Unscape HTML variables

Opened this issue · 1 comments

Is a way to pass HTML content in a variable and disable the escaping process?

P.e.:

<html><body>
{%$myvar = "<b>Hello</b> world"%}
{%$myvar}
</body></html>

Expected output:

<html><body>
<b>Hello</b> world
</body></html>
fefit commented

@imayatech since FET will translate the code into html/template template code, the func.go provides a method named safe to allowed HTML output.

func safe(html string) template.HTML {

so you can use the method in the code like below:

<html><body>
{%$myvar = "<b>Hello</b> world"|safe%}
{%$myvar}
</body></html>

I hope that can solves your problem. thx for your issue~