# 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)
Note that for a #
to introduce a comment, it must either
#
must always be followed by whitespace. #
inside quoted scalars never start comments. #
may introduce comments at the end of block scalars, but therefore, it must be less indented than the block scalar's base indentation (which is usually determined by the indentation of its first non-empty line).