YAML comments in multi-line strings

No. Per the YAML 1.2 spec “Comments must not appear inside scalars”. Which is exactly the case here. There’s no way in YAML to escape the octothorpe symbol (#) so within a multi-line string there’s no way to disambiguate the comment from the raw string value.

You can however interleave comments within a collection. For example, if you really needed to, you could break your string into a sequence of strings one per line:

key: #comment
  - value line 1
  #comment
  - value line 2
  #comment
  - value line 3

Should work…

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)