How to render template component variables as html


A quick one here.

I’ve got this code right here:

{{#if missions}}
        <h2>{{#if userName}}{{i18n (theme-prefix "sidebar.back")}} {{userName}} {{/if}}!</h2>
        <p>Voici vos missions:</p>
        <div class="mission">
            <h3>Mission du jour: {{missions.daily.mission.label}}</h3>

Everything is alright, except that my “description” variable contains html.

It doesn’t get rendered in my template so it prints out ugly html on my frontend :arrow_down:

Is there a way to interpret what’s between brackets {{}} as html?

Where is the documentation regarding this? I’m currently reverse engineering existing code so that’s not ideal.

Thanks in advance for any tips!

Because it was originally designed to generate HTML, Handlebars escapes values returned by a {{expression}} . If you don’t want Handlebars to escape a value, use the “triple-stash”, {{{ .
Introduction | Handlebars


There’s htmlSafe:

1 Like