Usually, if you use templating by Underscore.js, any expression that looks like <% ... %>
and <%= ... %>
is parsed by Underscore.js
How do I escape such a value, in case I want to embed the text <% ... %>
inside the template?
To put it in other words: How can I tell Underscore.js to ignore something that looks like a placeholder, but that isn't a placeholder?
I guess I have to use some kind of escaping, but the usual \
won't work. If I type
_.template('<%= name %> ### \<%= name %>', { name: 'foo' });
I get foo ### foo
as a result, which is obviously not what I wanted.
Update: To make more clear, what I want from the line above - it should result in
foo ### <%= name %>