This is a long string \n\n\n with new lines But it prints "\ n" instead of creating...">

New line "\ n" in yaml file

I would like to do it

test: > This is a long string \n\n\n with new lines 

But it prints "\ n" instead of creating new lines.

I know it is possible to do

 test: "This is a long string \n\n\n with new lines" 

But I would prefer not to add quotes everywhere, if possible. Thanks for the help!

EDIT: I would prefer not to use blank lines. In other words, I would like to use \ n to display blank lines to make my yml file more readable.

+6
source share
2 answers

try it

 test: |+ This is a long string with new lines 

| after the key helps at the beginning of multi-line text with indentation and supports indentation for a long line.

+13
source

You can do it:

 test: >+ This is a long string with new lines 
0
source

Source: https://habr.com/ru/post/920977/


All Articles