hogan.js icon indicating copy to clipboard operation
hogan.js copied to clipboard

Allow Html Unescaped Output

Open micahasmith opened this issue 14 years ago • 8 comments

Perhaps create a tag that means "allow html unescaped output", similar to jade?

http://stackoverflow.com/questions/6926247/nodejs-jade-escape-markup

micahasmith avatar Dec 27 '11 11:12 micahasmith

The Mustache spec already supports this with triple brace:

{{{" "}}}

bradwright avatar Dec 27 '11 11:12 bradwright

Ha! My bad. Thanks for schooling me on that

micahasmith avatar Dec 27 '11 12:12 micahasmith

What about if you change delimiters?

denisrobert avatar Jul 31 '13 12:07 denisrobert

I have the same question as @denisrobert. What if we've changed delimiters?

bentedder avatar Sep 17 '14 21:09 bentedder

Found the answer. I'm using assemble (https://github.com/assemble/assemble/), so it's already using double curly braces. In order to be able to use the double curly braces with Hogan I simply escaped them with a backslash so Assemble wouldn't try to parse w/handlebars.

bentedder avatar Sep 17 '14 21:09 bentedder

I Can't get HTML escape to work with changed delimiters. Any help in the direction ?

wardhanster avatar Mar 22 '16 12:03 wardhanster

@wardhanster @bentedder @denisrobert I know, this is quite old, but still.

Mustache specs allows to use & character after the delimiter. It works the same way as triple brace, but can be used with other delimiters as well.

From the spec:

You can also use & to unescape a variable: {{& name}}. This may be useful when changing delimiters (see "Set Delimiter" below).

See working example with changed delimiters on RequireBin:

view on requirebin

neustroev avatar Jun 17 '16 14:06 neustroev

@denisrobert @bentedder @wardhanster I got it to work with using: [[{variable}]]

oncode avatar Oct 17 '19 14:10 oncode