评论

# This comment occupies a whole line
- some item # This comment succeeds content of a line
- http://example.com/#nocomment
- "This # does not introduce a comment."
- |
    This is a block scalar.
    A # inside it does not introduce a comment.
   # unless it is less indented than the first line (this is one)

请注意,对于 # 引入注释,它必须要么

  • 发生在一行的开头,或
  • 之前是空格。

# 必须始终跟随空格。引用标量内的 # 永远不会发表评论。# 可能会在块标量的末尾引入注释,但因此,它必须比块标量的基本缩进(通常由其第一个非空行的缩进确定)缩进。