11

How can I break a long string in YAML (like long url, or filename/path), without newlines becoming spaces?

Example input:

url: >
  https://example.com/?what=Lorem
  %20ipsum%20dolor
  %20sit%20amet

Output:

{
  "url": "https://example.com/?what=Lorem %20ipsum%20dolor %20sit%20amet"
}

Desired output:

{
  "url": "https://example.com/?what=Lorem%20ipsum%20dolor%20sit%20amet"
}
Gargauth
  • 2,495
  • 6
  • 27
  • 30
  • Does this answer your question? [Is there a way to represent a long string that doesnt have any whitespace on multiple lines in a YAML document?](https://stackoverflow.com/questions/6268391/is-there-a-way-to-represent-a-long-string-that-doesnt-have-any-whitespace-on-mul) – Federico Grandi Sep 30 '22 at 12:20

1 Answers1

5

Turns out Google failed on me and this question was already asked and answered on this site: Is there a way to represent a long string that doesnt have any whitespace on multiple lines in a YAML document?

Community
  • 1
  • 1
Gargauth
  • 2,495
  • 6
  • 27
  • 30