YAML & Config

YAML Multiline Strings

Choose a block scalar when a YAML value needs more than one line. The marker controls whether line breaks are preserved or folded.

Published

Choose the block style

Literal | vs folded >

|

Preserves line breaks

script: |
  npm ci
  npm test

Use it for scripts, certificates and text whose line structure matters.

>

Folds ordinary lines

summary: >
  Build completed
  without errors.

Use it for readable wrapped prose that should become one sentence.

Decision

When should I use | or >?

  1. Need exact line breaks?Use |
  2. Need readable wrapped prose?Use >

Interactive proof

See chomping and indentation in real YAML

Choose a block scalar preset, then load it into the actual YAML Formatter to validate and edit it.

Selected preset

Preserve line breaks with |

A literal block keeps the line breaks in a small shell script.

script: |
  npm ci
  npm test

Expected result: Valid YAML with a script value containing two lines.

Why this fails

Block content must sit below the key

Broken
message: |
first line
Corrected
message: |
  first line

Practice with the full tool

Format your multiline YAML

Use your own YAML and check indentation, block scalars and formatting in the full local-first workflow.

Continue in YAML Formatter →