如何使 node.js 的 hbs 模块检索 HTML 中的信息而不是纯文本?
How to make the hbs module of node.js retrieve info in HTML instead of plain text?
我有一个 handlebars 文件 (index.hbs),它正在从我的 server.js 接收一些数据,比如这个:
{{#each person}}
{{name}}
{{bio}}
{{/each}}
但是 {{bio}} 填充了一些 HTML 数据,例如:
Hello this is my <b>bio</b> and has HTML on it.
我怎样才能做到HTML?因此,例如 b 标签显示为粗体而不是 HTML 标签。
找到了!只需再添加一对花括号即可。像这样:
{{{bio}}}
我有一个 handlebars 文件 (index.hbs),它正在从我的 server.js 接收一些数据,比如这个:
{{#each person}}
{{name}}
{{bio}}
{{/each}}
但是 {{bio}} 填充了一些 HTML 数据,例如:
Hello this is my <b>bio</b> and has HTML on it.
我怎样才能做到HTML?因此,例如 b 标签显示为粗体而不是 HTML 标签。
找到了!只需再添加一对花括号即可。像这样:
{{{bio}}}