FormattersLesson 12Free preview
YAML Formatter
This lesson is part of Web Developer Tools · All levels
Summary
YAML Formatter refines YAML structures with spatial-based indentations to make mapping and lists easy to read. YAML is very sensitive to indentation: tabs should not be used, and the number of spaces should be consistent. The formatter helps rearrange configuration files such as docker-compose or CI workflow. Comments with the # and value strings are maintained, but invalid structures must be fixed first.
Key points
- YAML's indentation uses spaces, not tabs.
- Mapping is written as key: value and list using the minus sign
- Consistency of the number of spaces is essential to maintain the structure
- Comments with # are maintained by the formatter
- Strings containing special characters like colon need to be quoted
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.