简体   繁体   English

蒸气从MySQL渲染HTML

[英]Vapor render html from MySQL

I'm using vapor framework and created a table with longText type in mysql & store text with html tags in it, 我正在使用蒸气框架,并在mysql中创建了一个带有longText类型的表,并在其中存储了带有html标签的文本,

+----+----------------------+
| id |       content        |
+----+----------------------+
|  1 | <b>title</b>sometext |
+----+----------------------+

now when i show them in leaf, it's shows with html tags like: 现在,当我在叶子中显示它们时,它显示带有html标签,例如:

<b>title</b>sometext

My Leaf file: 我的Leaf文件: 我的叶子文件 but i want to show like: 但我想显示如下:

title sometext 标题文本

how can i do this? 我怎样才能做到这一点? thanks 谢谢

Try something like 尝试类似

<pre class="item-body-text-pre">#raw(post.content)</pre>

You can use #raw(<yourVariableHere>) to insert unescaped text. 您可以使用#raw(<yourVariableHere>)插入未转义的文本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM