Harikrishnan
Harikrishnan

Reputation: 3802

Printing HTML tags without escaping using EJS

I am using EJS with Node JS. Also I am using i18n-node-2 for multilingual site. In my view I have a statement like this:

<h3 class="panel-title"><%= i18n.__("Business Card maker wizard - Step %s", "<span id='bcMakerStep'>1</span>") %></h3>

Here I want to output<span id='bcMakerStep'>1</span> as it is. But the EJS is transforming it into Business Card maker wizard - Step <span id='bcMakerStep'>1</span> so that is displaying as it is.

Is there any way in EJS to print the tags as it is?

PS: I have tested without EJS to check whether i18n-node-2 is doing that, but it is not but EJS.

Upvotes: 1

Views: 1035

Answers (1)

Harikrishnan
Harikrishnan

Reputation: 3802

I just found out the answer,

If we use <%- instead of <%= it will print characters unescaped.

Thanks to Jakub Oboza at https://stackoverflow.com/a/10330401/721597

Upvotes: 1

Related Questions