Mushyroom Blog

Block Style in YAML

January 17, 2024

tags: deveff, yaml,

Block Style in YAML

I tend to forget this syntax of using block style text in YAML file. I’m writing it down here for future reference.

Literal Style

keep the new lines

key: |
  line 1
  line 2

Folded Style

Change new lines to space except that it’s two new lines together

key: >
  line 1
  line 2

Indentation is assumed (decided) from the first line of the text. It can also be indicated explit

key: |2
  line 1
  line 2

Jason Ge 葛俊