Yaml Syntax Cheat Sheet

  



  • YAML Tutorial

About YAML syntax for workflows. Workflow files use YAML syntax, and must have either a.yml or.yaml file extension. For more information, see the 'Filter pattern cheat sheet.' Example including branches and tags. The patterns defined in branches and tags are evaluated against the Git ref's name. YAML stands for (YAML Ain’t Markup Language). It is a human friendly serialization language mainly used for configuration files. It can also be used for storing debugging output or document headers. It has a very limited syntax. It started with the reference as Yet another markup language, before it got the current YAML Ain’t Markup Language.

  • YAML Useful Resources
Sheet
  • Selected Reading

Yaml Syntax Online

Now that you have an idea about YAML and its features, let us learn its basics with syntax and other operations. Remember that YAML includes a human readable structured format.

Rules for Creating YAML file

Yaml Syntax Cheat Sheet

Yaml Syntax Cheat Sheet Free

When you are creating a file in YAML, you should remember the following basic rules −

  • YAML is case sensitive

  • The files should have .yaml as the extension

  • YAML does not allow the use of tabs while creating YAML files; spaces are allowed instead

Basic Components of YAML File

The basic components of YAML are described below −

Sheet

Conventional Block Format

This block format uses hyphen+space to begin a new item in a specified list. Observe the example shown below −

Inline Format

Inline format is delimited with comma and space and the items are enclosed in JSON. Observe the example shown below −

Yaml Syntax Cheat Sheet Printable

Folded Text

Folded text converts newlines to spaces and removes the leading whitespace. Observe the example shown below −

The structure which follows all the basic conventions of YAML is shown below −

Synopsis of YAML Basic Elements

  • The synopsis of YAML basic elements is given here: Comments in YAML begins with the (#) character.

  • Comments must be separated from other tokens by whitespaces.

  • Indentation of whitespace is used to denote structure.

  • Tabs are not included as indentation for YAML files.

  • List members are denoted by a leading hyphen (-).

  • List members are enclosed in square brackets and separated by commas.

  • Associative arrays are represented using colon ( : ) in the format of key value pair. They are enclosed in curly braces {}.

  • Multiple documents with single streams are separated with 3 hyphens (---).

  • Repeated nodes in each file are initially denoted by an ampersand (&) and by an asterisk (*) mark later.

  • YAML always requires colons and commas used as list separators followed by space with scalar values.

  • Nodes should be labelled with an exclamation mark (!) or double exclamation mark (!!), followed by string which can be expanded into an URI or URL.

  • YAML Tutorial

Yaml Syntax Cheat Sheet Download

  • YAML Useful Resources
  • Selected Reading

Yaml List Syntax

Now that you have an idea about YAML and its features, let us learn its basics with syntax and other operations. Remember that YAML includes a human readable structured format.

Rules for Creating YAML file

When you are creating a file in YAML, you should remember the following basic rules −

Syntax
  • YAML is case sensitive

  • The files should have .yaml as the extension

  • YAML does not allow the use of tabs while creating YAML files; spaces are allowed instead

Basic Components of YAML File

The basic components of YAML are described below −

Conventional Block Format

This block format uses hyphen+space to begin a new item in a specified list. Observe the example shown below −

Inline Format

Inline format is delimited with comma and space and the items are enclosed in JSON. Observe the example shown below −

Folded Text

Folded text converts newlines to spaces and removes the leading whitespace. Observe the example shown below −

The structure which follows all the basic conventions of YAML is shown below −

Synopsis of YAML Basic Elements

  • The synopsis of YAML basic elements is given here: Comments in YAML begins with the (#) character.

  • Comments must be separated from other tokens by whitespaces.

  • Indentation of whitespace is used to denote structure.

  • Tabs are not included as indentation for YAML files.

  • List members are denoted by a leading hyphen (-).

  • List members are enclosed in square brackets and separated by commas.

  • Associative arrays are represented using colon ( : ) in the format of key value pair. They are enclosed in curly braces {}.

  • Multiple documents with single streams are separated with 3 hyphens (---).

  • Repeated nodes in each file are initially denoted by an ampersand (&) and by an asterisk (*) mark later.

  • YAML always requires colons and commas used as list separators followed by space with scalar values.

  • Nodes should be labelled with an exclamation mark (!) or double exclamation mark (!!), followed by string which can be expanded into an URI or URL.