多行字符串可以使用|
保留换行符,也可以使用>
折叠换行。
this: | Foo Bar that: > Foo Bar
转为 JavaScript 代码如下。
{ this: 'Foo Bar ', that: 'Foo Bar ' }
+
表示保留文字块末尾的换行,-
表示删除字符串末尾的换行。
s1: | Foo s2: |+ Foo s3: |- Foo
转为 JavaScript 代码如下。
{ s1: 'Foo ', s2: 'Foo ', s3: 'Foo' }
转自
YAML 语言教程 - 阮一峰的网络日志
https://www.ruanyifeng.com/blog/2016/07/yaml.html