0 votes
in JSON by
How do I break a string in YAML over multiple lines?

1 Answer

0 votes
by

Using yaml folded style. The indention in each line will be ignored. A line break will be inserted at the end.

Key: >
  This is a very long sentence
  that spans several lines in the YAML
  but which will be rendered as a string
  with only a single carriage return appended to the end.

You can use the "block chomping indicator" to eliminate the trailing line break, as follows:

Key: >-
  This is a very long sentence
  that spans several lines in the YAML
  but which will be rendered as a string
  with NO carriage returns.

In either case, each line break is replaced by a space.

There are other control tools available as well (for controlling indentation for example).

Related questions

0 votes
asked Jan 5, 2021 in JSON by GeorgeBell
0 votes
0 votes
asked Jan 14, 2021 in JSON by RShastri
...