玉器中的竖杠是什么?

What is a vertical bar in jade?

要将 HTML 转换为翡翠,请使用此 jade converter

当我输入下面的HTML,

<!doctype html>
<html class="no-js">
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <div class="container">
      <div class="header">
        <ul class="nav nav-pills pull-right">
          <li class="active"><a href="#">Home</a></li>
          <li><a href="#">About</a></li>
          <li><a href="#">Contact</a></li>
        </ul>
      </div>
    </div>
</body>
</html>

输出结果如下:

doctype html.no-js
head
    meta(charset='utf-8')
  |   
  body
    .container
      .header
        ul.nav.nav-pills.pull-right
          li.active
            a(href='#') Home
          |           
          li
            a(href='#') About
          |           
          li
            a(href='#') Contact

竖线 (|) 的用途是什么?

只是jade模板中纯文本的更好可视化。见 https://pugjs.org/language/plain-text.html

快速更新@burnedikt 的回答。由于“Jade”一词的版权问题,Jade 现在更名为 Pug,网站也发生了变化。当前link是https://pugjs.org/language/plain-text.html#piped-text.

仅供参考,它的意思很简单:

Another way to add plain text to templates is to prefix a line with a pipe character (|). This method is useful for mixing plain text with inline tags, as we discuss later, in the Whitespace Control section.

如果您有兴趣在每次都不必使用垂直斜线('pipe' 字符的另一个名称)的情况下处理多行文本,请查看此答案:jade template engine (under node.js): multi-line block without pipe symbol.