所有!我在MEAN架构中创建了一个类似于StackOverflow的网站,用户可以在其中提交一些文本,其中包含丰富文本的拼写,但也可以包含代码片段 .

目前,我正在使用如下模式将这些帖子的内容存储在我们的mongo库中:

{
    .
    .
    .
    content : String
    .
    .
    .
}

示例内容:

here is some text, <b> some of it is also bold.</b>
there are also breaks, usually before entering formatted code:
<pre> <code> here is some code
it
has to look
    formatted in the way the user posted it
</code> </pre>

我如何将它存放在我的基地并将其显示在我的玉器中,所以它看起来如下所示?


这里有一些文字, some of it is also bold. 也有中断,通常在输入格式化代码之前:

here is some code
it
has to look
    formatted in the way the user posted it

谢谢!