Personal tools

YAML Tutorial

From Essentials

Jump to: navigation, search

YAML Rules

  • Applicable YAML files: all files with a .yml extension.
    • Essentials uses a config.yml file.
  • Tabs are NOT allowed, use spaces ONLY.
  • You MUST indent your properties and lists with 1 or more spaces.
  • All keys/properties are case-sensitive. ("ThIs", is not the same as "thiS")

YAML Parser

ALWAYS check your YAML config files against this parser: YAML Parser
When using the parser, CORRECT output looks like this: Image:Output.png
The file used for the tutorial and for the output is here: HelloWorld

Text Editor Use

Please use notepad++ (free) or another program to convert your TABs to spaces if you want to easily edit your YAML config files using the TAB key. If you do NOT have a program which can convert TABs to spaces, then do NOT use the TAB key to indent your YAML.

Within notepad++ Click Settings -> Preferences -> Language Menu/Tab Settings, which will take you to the following screen.

YAML Key-Property Structure Tutorial

Notice that the properties are spaced 2 from the margin. This is called indenting. YAML is very strict with indentation and it MUST be done every time you add a new property to a key.

Notice that this key-property structure and the above one are similar, but are fundamentally different (by YAML standards that is).

"The keys helloworld and HelloWorld are identical except for their case. Don't forget this. YAML will treat these keys as two separate and unrelated keys."

Take notice of the different types of values and how you're able to use them with stand-alone keys. No, you do not need the keyword key for those to be valid keys. Keys can have any name as long as the name only contains letters.

Your lists structure must look IDENTICAL to the one below or errors will occur. You might be able to get away with a little more indentation before the "-", but that's it.