取代
key:
- thisvalue
- thatvalue
- anothervalue
我想要
key:
1. thisvalue
2. thatvalue
3. anothervalue
仅为了人类可读性,与{key: [thisvalue, thatvalue, anothervalue]}
的相同解释。
这似乎不是基本的YAML语法的一部分,但是否有一种方法可以实现这一点 - 也许使用YAML中可能存在的一些高级技巧?
(我意识到可以将列表写成以下形式来近似:
key:
- 1. thisvalue
- 2. thatvalue
- 3. anothervalue
但这是一个丑陋的 hack,我更喜欢一个数字具有语义目的的解决方案,而不仅仅是值文本的一部分,这也需要被解析和删除。