Insert html in a handlebar template without escaping

Insert html in a handlebar template without escaping

Is there a way to insert a string with html tags into a handlebars template without getting the tags escaped in the outcoming string?
template.js:

{{content}}

use the template
HBS.template({content: “test 123″})

actual outcome:

<i>test</i> 123

expected result:

test 123

Solutions/Answers:

Solution 1:

Try like

<p>{{{content}}}</p>

I got the official reference to support my answer:

Handlebars HTML-escapes values returned by a {{expression}}. If you
don’t want Handlebars to escape a value,
use the “triple-stash”, {{{.

Solution 2:

In your template you must add triple mustaches like this. <p>{{{content}}}</p>

Solution 3:

According to Handlebars documentation, http://handlebarsjs.com/expressions.html

Quote from documentation,

If you don’t want Handlebars to escape a value, use the “triple-stash”, {{{

Pass the raw HTML to Handlebars template and get the raw HTML output by using triple brackets.

{{{foo}}}