software:yaml
**This is an old revision of the document!**
YAML
multi-line strings
copied from Stack Overflow
>→ interior line breaks are stripped out, although you get one at the end.|→ line breaks are preserved as \n>-→ like>but without trailing line break|-→ like|but without trailing line break
In this table: \b means space character, \n means “newline character” except were noted. “Leading space” refers to an additional space character on the second line, when the first is only spaces (which establishes the indent).
> | | | >- | |- | >+ | |+ | " | ' |
||
|---|---|---|---|---|---|---|---|---|---|
| Spaces/newlines converted to: | |||||||||
| Trailing space | \b | \b | \b | \b | \b | \b | |||
| Leading space | \n\b | \n\b | \n\b | \n\b | \n\b | \n\b | |||
| Single newline | \b | \n | \b | \n | \b | \n | \b | \b | \b |
| Double newline | \n | \n\n | \n | \n\n | \n | \n\n | \n | \n | \n |
| Final newline | \n | \n | \n | \n | |||||
| Final double newline | \n | \n | \n\n | \n\n | |||||
| How to create a literal: | |||||||||
| Single quote | ' | ' | ' | ' | ' | ' | ' | ' | '' |
| Double quote | “ | ” | “ | ” | “ | ” | “ | \” | “ |
| Backslash | \ | \ | \ | \ | \ | \ | \ | \\ | \ |
| Other features | |||||||||
| In-line newlines with literal \n | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | ✅ | 🚫 |
Spaceless newlines with \ | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | ✅ | 🚫 |
| # or : in value | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚫 | ✅ | ✅ |
| Can start on same line as key | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | ✅ | ✅ | ✅ |
software/yaml.1748359613.txt.gz · Last modified: 2025/05/27 15:26 by ron
