Line Breaks and Multiline Strings in YAML

A simple introduction courtesy of Symfony:

Folded style, introduced by >

# Each line break is folded to a space
# Makes YAML more readable
accomplishment: >
  Mark set a major league
  home run record in 1998.

# Literal style, introduced by |
# All line breaks count
# Indentation doesn't appear in the resulting string
stats: |
  65 Home Runs
  0.278 Batting Average
This entry was posted in essays and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Trackback

  • [...] mine, because YAML files are easily read and easily edited. Also, there’s great support for multiline strings. Multiline strings in YAML are smart about their indent level, so unlike Ruby, you don’t have [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>