Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert html in a handlebar template without escaping

People also ask

Does handlebars escape HTML?

HTML EscapingHandlebars will not escape a Handlebars.

How do you add templates in your HTML in handlebars?

Templates The recommended way of adding templates to your page is by including them in <script> tags with a special type. The type attribute is important, otherwise the browser will attempt to parse them as JavaScript (which they are not). The templates have an easy to grasp syntax.

What is handlebars in node JS?

Handlebars. js is a templating engine similar to the ejs module in node. js, but more powerful and simple to use. It ensures minimum templating and is a logicless engine that keeps the view and the code separated. It can be used with express as the hbs module, available through npm.


Try like

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

official reference:

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


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


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}}}