使用Meteor插入HTML标记

时间:2013-01-10 21:47:28

标签: html templates meteor markup

如何在Meteor模板中显示标记的字符串数据?

我需要在数据库中显示一个包含一些基本HTML标记的字符串,以便生成的文本格式正确。它目前只显示标记文本。

以下是模板的相关部分:

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

其中{{description}}是包含标记的字符串(例如“hello&lt; br&gt; world”)。

我希望它显示

hello
world

而不是

hello<br>world

我想这与在javascript中使用innerHTML类似。

提前致谢!

1 个答案:

答案 0 :(得分:62)

要在Handlebars中覆盖HTML-escape,请使用triple-stash:

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