comments - multiple - yaml syntax
How do you do block comments in YAML? (6)
An alternative approach:
- your YAML structure has well defined fields to be used by your app
- AND you may freely add additional fields that won't mess up with your app
- at any level you may add a new block text field named like "Description" or "Comment" or "Notes" or whatever
# This comment # is too long
Description: > This comment is too long
Comment: > This comment is also too long and newlines survive from parsing!
- If the comments become large and complex and have a repeating pattern, you may promote them from plain text blocks to objects
- Your app may -in the future- read or update those comments
How do I comment a block of lines in YAML?
Emacs has comment-dwim (Do What I Mean) - just select the block and do a:
It's a toggle - use it to comment AND uncomment blocks.
If you don't have yaml-mode installed you will need to tell Emacs to use the hash character (#).
If you are using Eclipse with the yedit plugin (an editor for .yaml files), you can comment-out multiple lines by:
- selecting lines to be commented, and then
- Ctrl + Shift + C
And to un-comment, follow the same steps.
In Vim you can do one of the following:
- Comment all lines:
- Comment lines 10 - 15:
- Comment line 10 to current line:
- Comment line 10 to end:
or using visual block:
- Select a multiple-line column after entering visual block via Ctrl+v.
- Press r followed by # to comment out the multiple-line block replacing the selection, or Shift+i#Esc to insert comment characters before the selection.
The spec only describes one way of marking comments:
An explicit comment is marked by a “#” indicator.
That's all. There are no block comments.