Saturday, March 2, 2019

Yaml - how to break very long string




I have an entry in my yaml file that looks like this



my_key:['short string', 'thisisaverylongstringthatcontains.,specialcharacterssoI havetousequotes,andI wanttobreakintomultiplelines']



My very long string can't contain spaces, and I am worried if I simply use newline, it will get converted to space.
What is the cleanest, simplest way to break down that second string across multiple lines for easier readability and convenience?


Answer



key  : ['short string', "this is a very long string 
that I want to break into
multiple lines"]


Have you tried just inserting a newline? This is valid YAML.




If you don't want spaces, add \ to the end of each line.



key  : ['short string', "this is a very long string\
that I want to break into\
multiple lines"]

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...