如何在<pre> with Jade without removing newlines?

时间:2015-10-18 14:16:37

标签: pug

I would like the generated HTML to be:

>>> print(r'C:\a')
C:\a

I tried using:

<!DOCTYPE html>
<html>
  <head></head>
  <body>
    <pre>First line
<em>Second line</em>
Third line</pre>
  </body>
</html>

But it doesn't work, because doctype html html head body pre. First line em second line third line considers everything under it to be text. So I tried removing it and using pre. instead, as in:

|

But this puts everything inside the doctype html html head body pre | First line em second line | third line on a single line, as in:

pre

Which is not what I want. As far as I can see, my only option is to embed HTML in Jade, as in:

<!DOCTYPE html>
<html>
  <head></head>
  <body>
    <pre>First line<em>second line</em>third line</pre>
  </body>
</html>

Is there another way?

1 个答案:

答案 0 :(得分:1)

您希望 转义 HTML

[1,3,4,5,6,7,9]

或使用pre. First line &lt;em&gt;second line&lt;/em&gt; third line

#{}