Two block scalar styles, plus indicators
| — literal: keep every newline
Pipe means 'preserve newlines exactly.' Use this for shell scripts, code blocks, multi-paragraph descriptions where line breaks matter.
> — folded: join with spaces, blank line = paragraph break
Greater-than means 'fold consecutive non-empty lines into one with a space, treat blank lines as paragraph breaks.' Use this for prose paragraphs that should wrap freely on output but read narrow in the source.
Chomping indicators
Append - or + after | or > to control the trailing newline:
|or>— clip (default). One trailing newline.|-or>-— strip. No trailing newline.|+or>+— keep. All trailing newlines.
Indentation indicator (rare but useful)
|2 means 'block scalar with 2-space indent inside.' Useful when the content's first line itself begins with whitespace and the parser would otherwise miscount.
Folded mode silently corrupts code: if you put a Python or YAML snippet inside
>, all your line breaks become spaces and you get a syntactically broken blob. Always use | for code blocks; use > only for prose where wrap-on-render is fine.