YAML is a human-friendly data serialization standard for all programming languages. It is commonly used for configuration files and in applications where data is being stored or transmitted.
The Normal Way for commenting in YAML is Inline commenting with the “#” symbol, however, if you want to comment blocks then we have a list of ways in which it can be done.
Step 1: Select the block
Step 2: Press cmd plus / on Mac or press ctrl plus / on Linux & Windows.
Note: This method works on the following editors –
- Sublime Text Editor
- Atom Editor
- Eclipse (with YEdit plugin)
- JetBrains IDEs: RubyMine and Gogland
- Visual Studio Code
At any level of the code, you may add a new block text named like “Description” or “Comment” or “Notes” or whatever that you wish
Instead of # This comment # is too long use Description: > This comment is too long or Comment: > This comment is also too long and newlines survive from parsing!
- If the comments become too large and too complex and have a lot of repeating pattern, you may want to promote them from plain text blocks to objects.
- Your app may need to read/update the comments in the future.
- This method is very handy especially if anyone wants these comments to appear in JSON or XML if one is to transform from YAML to these two.
- What is the difference between YAML and JSON?
- HTML | Comments
- Comments in C/C++
- Concept of Comments in Computer Programming
- SASS | Comments
- Comments in R
- CSS | Comments
- How to write comments in HTML ?
- Where is an object stored if it is created inside a block in C++?
- What is the difference between display: inline and display: inline-block in CSS?
- How to remove the space between inline-block elements?
- HTML | Block and Inline Elements
- How to add `style=display:“block”` to an element using jQuery?
- What is the difference between inline-flex and inline-block in CSS?
- CSS | margin-block Property
- CSS | border-block-start-style Property
- CSS | border-block-start-color Property
- CSS | border-block-start-width Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.