Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YAML multiline wrap without space

Tags:

yaml

word-wrap

I tried to understand the specifications here but they're actually quite difficult to understand.

http://www.yaml.org/spec/1.2/spec.html#id2779048

As far as I can see, there are three ways of wrapping text but their function is very similar... in fact so similar that I don't get the point in having all of them instead of one or two.

Well my problem is that I have some String that is really long (~700 characters) but has no whitespaces. Now of course I want to put it into multiple lines but there seems to be no way to do so without having any linefeeds or space characters that I do not want.

So is this actually possible?

--- aTest:     hereComes     SomeText     ThatShould     NotHave     AnyWhitespaces 
like image 765
swenzel Avatar asked Oct 03 '13 20:10

swenzel


People also ask

How do I break a string in YAML over multiple lines?

Use >- or |- instead if you don't want a linebreak appended at the end. Use "..." if you need to split lines in the middle of words or want to literally type linebreaks as \n : key: "Antidisestab\ lishmentarianism. \n\nGet on it."

How do I give multiple values in YAML?

In YAML, Array represents a single key mapped to multiple values. Each value starts with a hyphen - symbol followed by space. In a single line, write the same thing above using 'square brackets syntax. '

What does pipe mean in YAML?

The pipe symbol at the end of a line in YAML signifies that any indented text that follows should be interpreted as a multi-line scalar value. See the YAML spec. Specifically, the pipe indicates that (except for the indentation) the scalar value should be interpreted literally in such a way that preserves newlines.


1 Answers

It's possible. See. Is there a way to represent a long string that doesnt have any whitespace on multiple lines in a YAML document?

Quoted example:

"abcdefghi\ jklmnopqr\ stuvwxyz" 

Single quotes also work.

like image 105
Tek Avatar answered Sep 25 '22 09:09

Tek