yaml - ilya-khadykin/notes-outdated GitHub Wiki
YAML Basics
Beginning and ending document
--- # beginning of the document
# contents
... # end of the document
Lists
---
# A list of tasty fruits
fruits:
- Apple
- Orange
- Strawberry
- Mango
fruits2: ['Apple', 'Orange', 'Strawberry', 'Mango']
...
Dictionary
# An employee record
martin:
name: Martin D'vloper
job: Developer
skill: Elite
martin2: {name: Martin D'vloper, job: Developer, skill: Elite}
Lists of dictionaries
# Employee records
- martin:
name: Martin D'vloper
job: Developer
skills:
- python
- perl
- pascal
- tabitha:
name: Tabitha Bitumen
job: Developer
skills:
- lisp
- fortran
- erlang
Boolean value formats
create_key: yes
needs_agent: no
knows_oop: True
likes_emacs: TRUE
uses_cvs: false
Span multiple lines
|
will include the newlines
>
will ignore newlines
include_newlines: |
exactly as you see
will appear these three
lines of poetry
ignore_newlines: >
this is really a
single line of text
despite appearances
Delaing with special characters
Turn special characters [] {} : > | .
into strings
#foo: somebody said I should put a colon here: so I did # incorrect
foo: "somebody said I should put a colon here: so I did" # correct
foo: "{{ variable }}"
non_boolean: "yes"
other_string: "False"
version: "1.0"
General example
---
# An employee record
name: Martin D'vloper
job: Developer
skill: Elite
employed: True
foods:
- Apple
- Orange
- Strawberry
- Mango
languages:
perl: Elite
python: Elite
pascal: Lame
education: |
4 GCSEs
3 A-Levels
BSc in the Internet of Things