Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does YAML Interpret Special Characters

So, I'm attempting to write a plugin configuration file in YAML, but my parser is throwing errors even though everything seems to be formatted correctly. The YAML website is less than helpful, and the only place I've found a tutorial of any kind is the spotty one at docs.ansible.com/ansible/YAMLSyntax.html. Since I am probably missing something silly in the syntax from a general lack of YAML syntax knowledge, what do each of the YAML special characters do?

For reference, here is my misbehaving YAML file:

EnforcedWorlds:|
  - World
  - Nether
  - DIM-1
  - End
  - DIM1
Ignore List:|
  - CuckooClock5000
  - Venomous Potato
  - Subtle Snail
Radius: 10
DisallowInRadius:|
  - Sandstone => "Darude Sandstone!"
  - Quarry (1040) => "This block is too L33T 4U 2 Use here :)"
  - Minium Stone (20102 with datavalues 1 to 1520) => "Minimum Minium area!"
Command Output groups:
  Mod:|
    - Perm Node: gpu.mod
    - (Light Green) $(Banner)
    - (Teal) Command A
    - (Pink) Command B
  Admin:|
    - Perm Node: gpu.admin
    - (Light Red) $(Banner)
    - Mod lines 2-3
    - (Blue) Command C
    - (Bold)
  Owner:|
    - Mod lines 1-3
    - Admin line 2
like image 500
Nathan Meyer Avatar asked May 07 '26 14:05

Nathan Meyer


1 Answers

YAML doesn't require quoting most strings but you'll want to quote special characters if they fall within a certain list of characters. Use quotes if your value includes any of the following special characters: {, }, [, ], &, *, #, ?, |, -, <, >, =, !, %, @, : also ` and ,

  • YAML Spec
like image 157
TheZeke Avatar answered May 09 '26 14:05

TheZeke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!