YAML Tutorial

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 ParserWhen using the parser,  CORRECT output looks like this:  Image:Output.pngThe 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 Tutorial_第1张图片


YAML Key-Property Structure Tutorial

YAML Tutorial_第2张图片
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.


YAML Tutorial_第3张图片
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."


YAML Tutorial_第4张图片
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.


YAML Tutorial_第5张图片
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.

你可能感兴趣的:(YAML Tutorial)