Yaml multiline strings

First, decide whether you want to fold newlines or preserve them using the Block Style Indicator. There are two options:

  • The literal style (|) will preserve newlines

  • The folded style (>) will replace newlines with spaces

(To get a newline using the folded style, use a blank line (two newlines).)

multiline: >
  this will
  be a single
  line

  but this will be a
  separate one
multiline: |
  these newlines
  will be preserved

Then there are options for newlines at the end:

  • |- will strip newlines

  • |+ will keep all trailing newlines

  • | (specifying nothing) will leave a single newline

These options are available both in the folded and the literal style.

Source

Last updated