简体   繁体   English

多行字符串作为序列的一部分

[英]Multi-line string as part of sequence

I can't figure out how to use a multi-line string as part of a yaml sequence: 我无法弄清楚如何使用多行字符串作为yaml序列的一部分:

foo:
  - bar
  - bar2
  - > super duper long
 string that I would like
 to have on multiple lines
  - Another item

Is it possible? 可能吗?

If you want to use a folded scalar: 如果你想使用折叠标量:

foo:
  - bar
  - bar2
  - >
     super duper long
     string that I would like
     to have on multiple lines
  - Another item

Note that there may not be content on the line of the folded scalar's header (the line with the > ). 请注意,折叠标量的标题(带有>的行)上可能没有内容。

Alternatively, you can just use a plain scalar: 或者,您可以使用普通标量:

foo:
  - bar
  - bar2
  - super duper long
    string that I would like
    to have on multiple lines
  - Another item

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM