Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data with < or > still escaping despite tag configured otherwise #655

Open
mikeerickson opened this issue Mar 29, 2022 · 1 comment
Open

Comments

@mikeerickson
Copy link

In short, I have the following

This is an encoded variable <%- myVar %>

When the template is rendered, it is escaping the < and > characters

This is an encoded variable &lt;mike&gt;
ejs.render('<%- myVar %>', {myVar: 'mike'})

I am expect output to be

<mike>

What should I be doing to make sure the < and > are actually rendered

@emmyarty
Copy link

Your output wouldn't include the angular brackets in the first place since the only brackets there are part of the EJS tag, so I don't think EJS is what's causing your problems here.

Are you trying to create html tags called Mike on the fly? Because you could probably do something like
ejs.render('<%- ``\<${myVar}>`` %>', { myVar: 'mike' });
for that.

Otherwise you'll want them escaped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants