Literature: YAML 1.2.2 Specification
YAML (YAML Ain’t Markup Language) is a human-friendly, Unicode-based data serialization language designed for clarity and compatibility with dynamic programming languages.
Core Syntax Rules
- Indentation: Whitespace only; tabs are strictly forbidden.
- Structure: Uses a combination of Mappings (key-value), Sequences (lists), and Scalars (strings/numbers).
- Markers:
-
---: Signals the start of a document or directive end....: Signals the end of a document.
-
Data Primitives
- Mappings: Block style (key: value) or flow style ({key: value}).
- Sequences: Block style (- item) or flow style ([item1, item2]).
- Scalars: Plain, double-quoted (supports escapes), single-quoted (literal), or block style (Literal
|vs. Folded>).
Frontmatter Requirements
The specification defines the standard pattern for Markdown metadata:
- Placement: Must be at the very beginning of the file.
- Delimiters: Must be wrapped in triple-dash
---markers. - Mapping: The content must be a valid YAML Mapping.
- Encoding: UTF-8 preferred.