Skip to content
Related Articles
Open in App
Not now

Related Articles

How to block comments in YAML ?

Improve Article
Save Article
  • Last Updated : 11 Jun, 2020
Improve Article
Save Article

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

Description: >
This comment
is too long

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.
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!