cheatsheets/yaml.md

70 lines
838 B
Markdown
Raw Permalink Normal View History

2014-02-25 10:32:14 +00:00
---
title: Yaml
2015-11-24 05:09:17 +00:00
category: Markup
2017-09-20 08:08:11 +00:00
prism_languages: [yaml]
2014-02-25 10:32:14 +00:00
---
### Dictionaries and lists
```yaml
# comments start with "#"
# dictionary are written like "key: value"
name: Martin D'vloper
languages:
perl: Elite
python: Elite
pascal: Lame
# list items beginn with a "- "
foods:
- Apple
- Orange
- Strawberry
- Mango
# booleans are lower case
employed: true
```
2017-09-20 08:08:11 +00:00
### Multiline strings
2014-02-25 10:32:14 +00:00
2017-09-20 08:08:11 +00:00
```yaml
# Literal Block Scalar
2017-09-20 08:08:11 +00:00
Multiline: |
exactly as you see
will appear these three
lines of poetry
```
```yaml
# Folded Block Scalar
Multiline: <
this is really a
single line of text
despite appearances
2017-09-20 08:08:11 +00:00
```
### Inheritance
```yaml
parent: &defaults
a: 2
b: 3
child:
<<: *defaults
b: 4
```
2020-02-17 23:13:10 +00:00
### Reference content
```yaml
2020-02-23 09:34:51 +00:00
values: &ref
- These values
- will be reused below
other_values:
<<: *ref
2020-02-17 23:13:10 +00:00
```