标签(Tags)

¥Tags

默认情况下,行首的文本(或仅在空格之后)表示 HTML 标记。缩进标签是嵌套的,创建 HTML 的树结构。

¥By default, text at the start of a line (or after only white space) represents an HTML tag. Indented tags are nested, creating the tree structure of HTML.

Pug 还知道哪些元素是自闭合的:

¥Pug also knows which elements are self-closing:

块扩展(Block Expansion)

¥Block Expansion

为了节省空间,Pug 为嵌套标签提供了内联语法。

¥To save space, Pug provides an inline syntax for nested tags.

自动关闭标签(Self-Closing Tags)

¥Self-Closing Tags

诸如 imgmetalink 之类的标签会自动自动关闭(除非你使用 XML 文档类型)。

¥Tags such as img, meta, and link are automatically self-closing (unless you use the XML doctype).

你还可以通过附加 / 字符来显式自关闭标签。仅当你知道自己在做什么时才这样做。

¥You can also explicitly self close a tag by appending the / character. Only do this if you know what you’re doing.

渲染空白(Rendered Whitespace)

¥Rendered Whitespace

标签开头和结尾的空格被删除,以便你可以控制渲染的 HTML 元素是否接触。空白控制通常通过 纯文本 处理。

¥Whitespace is removed from the beginning and end of tags, so that you have control over whether the rendered HTML elements touch or not. Whitespace control is generally handled via plain text.

Pug 中文网 - 粤ICP备13048890号