Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insert HTML markup using Meteor

How can I display marked up string data in a Meteor template?

I need to display a string from my database that contains some basic HTML tags such that the resulting text is properly formatted. It currently just displays the markup text.

Here's the relevant part of the template:

<span class="description">{{description}}</span>

Where {{description}} is the string containing markup (like "hello<br>world").

I'd like it to display

hello
world

rather than

hello<br>world

I guess this would be similar to using innerHTML in javascript.

Thanks in advance!

like image 389
Alex Brown Avatar asked Jan 10 '13 21:01

Alex Brown


1 Answers

To override HTML-escape in Handlebars, use the triple-stash:

<span class="description">{{{description}}}</span>
like image 192
ram1 Avatar answered Sep 25 '22 13:09

ram1