It turns out there are actually several different ways to handle multiline strings in YAML. I had noticed varying forms of the syntax but didn’t realize they process the strings differently.

YAML multiline strings is a handy site with interactive examples of the different forms.