Mustache: Globally disable html escaping?

It's actually pretty simple. Mustache offers the possibility to override the escape function. This allows you to disable the escaping by simply returning the original value.

mustache.escape = function (value)
{
    return value;
};

As mentioned by others, you can also use the following notation to disable escaping.

{{{ test }}}

I leave the answer unchanged, since it might be helpful to implement your own sanitizing.


If you are trying to just NOT HTML escape some strings, you just do {{{xx}}} instead of {{xx}}

As per:

http://mustache.github.io/mustache.5.html

So if you had a string that consisted of:

test => Q & A

Calling with:

{{ test }}

would give you:

Q & A

..but calling with:

{{{ test }}} or {{ &test }}

Would give you just:

q & a