YAML / quote / comment / syntax boundary

Review YAML comments, quotes and empty values

Review comment boundaries, quoted #, colon structure, empty values and plain scalars with fixed examples. No YAML parser is executed and no input is sent.

Fixed syntax-boundary examples

Results are not guaranteed to match every reader. Check the YAML version, schema and receiver you actually use.

caseFixed exampleBoundary
commentnote: left # comment
note: left#tag
A separated # versus a # inside the scalar
quoted-hashnote: "left # literal"# inside quotes belongs to the quoted scalar
colon-boundarylabel: left: right
label: "left: right"
endpoint: https://example.test/a:b
Structural : versus a colon without following space
empty-scalarvalue:
value: ""
An empty node versus an explicit empty string
plain-scalarfeature: onYAML 1.1 versus YAML 1.2 core schema

This page explains examples. It does not validate configuration, execute a parser or determine whether a configuration is safe.

Before handing a value off

  1. Use whitespace and quotes to distinguish a comment from a # in the value.
  2. If intended text contains : , quote it and check the target reader.
  3. Do not assume an empty node and an empty string are interchangeable.
  4. Record the YAML version and parser settings for values such as on.

For general boolean-like, date-like, numeric and null examples, see the YAML scalar coercion guide.

Primary specifications