Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

new line "\n" in yaml file

I'd like to do this

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

But it prints out the "\n" instead of making new lines.

I know it's possible to do

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

But i'd rather not add quotes everywhere if possible. Thanks for the help!

EDIT: I'd rather not use empty lines. In other words, i'd like to use \n to show empty lines to make my yml file more readable.

like image 603
montrealmike Avatar asked Jul 20 '12 15:07

montrealmike


1 Answers

try this

test: |+
  This is a long string


  with new lines

| after the key helps in beginning of multiline text indented and maintain the indentation for the long string.

like image 115
abhas Avatar answered Oct 19 '22 07:10

abhas