safeString
can.stache.safeString(str)
Parameters
-
str
{String}
A string you don't want to become escaped.
Returns
{String}
A string flagged by can.mustache
as safe, which will
not become escaped, even if you use {{{key}}}(triple slash).
If you write a helper that generates its own HTML, you will usually want to return a
can.stache.safeString.
In this case, you will want to manually escape parameters withcan.esc.
Rendering:
Results in:
As an anchor tag whereas if we would have just returned the result rather than a
can.stache.safeString
our template would have rendered a div with the escaped anchor tag.