删除 Html 个实体或替换标签

Delete Html entities or replace tag

当我显示 ckeditor 文本时,也会显示 html 标签。我怎样才能只显示文本?我得到这个:

<b>Paragraph</b>

段落

我使用 Jade 模板和节点。 可以在保存到数据库之前删除标签吗?或者在 ?

之后删除标签

谢谢。

我找到了解决办法。 只需在 Jade 模板中使用 !{value} 而不是 #{value} 来解码 html 个实体。 值包含 html 个实体。

在 pug 文件中使用 unescape 语法。

p
  != 'This code is <strong>not</strong> escaped!'

- var riskyBusiness = "<em>This code is <strong>not</strong> escaped!</em>";
.quote
  p Joel: !{riskyBusiness}