FANDOM


a sequence -- note the dash at the start:
	- Memoirs Found in a Bathtub
	- Snow Crash
	- Ghost World
"---" separates multiple documents in a single file:
	---
	- Harry Potter and the Prisoner of Azkaban
	- Harry Potter and the Goblet of Fire
	- Harry Potter and the Order of the Phoenix
	---
	- Memoirs Found in a Bathtub
	- Snow Crash
	- Ghost World
text that has a colon in it is a map with key on the left side:
	Stanislaw Lem: Memoirs Found in a Bathtub
	Neal Stephenson: Snowcrash
	Daniel Clowes: Ghost World
a sequence and a map:
	---
	- Stanislaw Lem: Memoirs Found in a Bathtub
	- Neal Stephenson: Snowcrash
	- Daniel Clowes: Ghost World
map inside a map:
---
	date: 2003-07-25
	letters to:
		"Hank Bros.: the Car Wash!": 1
		Jim O'Connor: 2
		Myself: 2
A ">" starts a folder block.  a blank line separates logical lines.  The value part of the map is only two lines:
---
	Concerning Car Washes: >

		We are sorry to have misplaced this letter.
		We were told by a reliable source that you
		were the owner of "Hank Bros.: the Car Wash!".

		Sorry.
A "|" starts a literal block.  Every physical line is a separate line.  The value part of the map is 6 liness:
	Concerning "Jim O'Connor": |

		You are receiving Jim O'Connor's mail for several reasons:
		- The nameplate on your mailbox still says his name.
		- He has told our postman that you screen his mail.
		- He is living in your ceiling.
		- He held a raygun to the postman's head.
A sequence nested inside of a dictionary:
	---
	name: Dirk Hockeybranch
	minutes spent: 
		- 1.02
		- 1.34
		- 0.7
		- 0.89
		- 0.94
The same as above, but using an inline sequence (must have a space after ','):
	---
	name: Dirk Hockeybranch
	minutes spent: [1.02, 1.34, 0.7, 0.89, 0.94]
An example of an inline map:
	---
	minutes spent: {one: 1.02, two: 1.34, three: 0.7,
		four: 0.89, five: 0.94}
Sequence within a sequence:
	---
	-
		- Golden Red Apple
		- Granny Smith Apple
		- Red Rome Apple
	- Peach
	- Plum
A folded block in a sequence:
	---
	- More about "Jim O'Connor"
	- >
		Your patience in dealing with Jim has been
		much appreciated. As a token of our gratitude
		please accept this gift.
A literal block in a sequence:
	---
	- RE: More about "Jim O'Connor"
	- |
		I thank you for your wonderful gift of a towel.
		It dries quickly, and it is as soft as down.
Keep (+) and chomp (-) operators are used to with literal or foloded blocks to say what to do with extra spaces and new lines:
	---
	normal: |
		This has one newline.

	kept: |+
		This has three newlines.

	chomped: |-
		This has no newlines.

	...
	---
	normal: >
		This has one newline.

	kept: >+
		This has three newlines.

	chomped: >-
		This has no newlines.
A merge key ('<<') can be used in a mapping to insert other mappings. If the value associated with the merge key is a mapping, each of its key/value pairs is inserted into the current mapping.
	mapping:
		name: Joe
		job: Accountant
		<<:
			age: 38
Any YAML type can be forced into a string using the explicit !str method:
	date string: !str 2001-08-01 
	number string: !str 192
Single-quoted Strings:
	all my favorite symbols: '#:!/%.)' 
	a few i hate: '&(*' 
	why do i hate them?: 'it''s very hard to explain
Double-quoted Strings:
	i know where i want my line breaks: "one here\nand another here\n"
Multi-line Quoted Strings:
	i want a long string: "so i'm going to
		let it go on and on to other lines
		until i end it with a quote."
Unquoted strings may also span multiple lines:
	- My little toe is broken in two places;
	- I'm crazy to have skied this way;
	- I'm not the craziest he's seen, since there was always the German guy
		who skied for 3 hours on a broken shin bone (just below the kneecap);
	- Nevertheless, second place is respectable, and he doesn't
		recommend going for the record;
	- He's going to put my foot in plaster for a month;
	- This would impair my skiing ability somewhat for the
		duration, as can be imagined.
You can use the tilde '~' character for a null value:
	name: Mr. Show
	hosted by: Bob and David
	date of next season: ~
You can use 'true' and 'false' for boolean values:
	Is Gus a Liar?: true
	Do I rely on Gus for Sustenance?: false
An integer or a float is a series of numbers:
	zero: 0
	simple: 12
	one-thousand: 1,000
	negative one-thousand: -1,000
	a simple float: 2.00 
	larger float: 1,000.09 
	scientific notation: 1.00009e+3
You can represent timestamps by using ISO8601 format:
	iso8601: 2001-12-14t21:59:43.10-05:00 
	space seperated: 2001-12-14 21:59:43.10 -05:00
A date can be represented by its year, month and day in ISO8601 order:
	--- 1976-07-31
If you need to refer to the same item of data twice, you can give that item an alias. The alias is a plain string, starting with an ampersand. The item may then be referred to by the alias throughout your document by using an asterisk before the name of the alias. This is called an anchor:
	- &showell Steve
	- Clark
	- Brian
	- Oren
	- *showell
An alias can be used on any item of data, including sequences, mappings, and other complex data types:
	- &hello 
		Meat: pork 
		Starch: potato 
	- banana 
	- *hello	
Multiple Document Separators in Block:
	foo: |
		---
		foo: bar
		---
		yo: baz
	bar: |
		fooness

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.