TPToolPazar
Ana Sayfa/Rehberler/How To Format Yaml

How To Format Yaml

📖 Bu rehber ToolPazar ekibi tarafından hazırlanmıştır. Tüm araçlarımız ücretsiz ve reklamsızdır.

Indentation rules

YAML uses indentation to express structure. Two spaces per level is the universal convention. Tabs are not allowed for indentation—the YAML spec explicitly bans them, and every parser will reject a document indented with tabs. Each nested level must be indented at least one space more than its parent, and all siblings at the same level must share the exact same indentation. The spec does not mandate exactly two spaces, but any consistent number works; the community has settled on two.

Strings and when to quote them

YAML supports two styles for collections. Block style uses indentation and dashes, which is the readable default for config files. Flow style uses braces and brackets like JSON, which is compact but harder to diff. Flow style is appropriate for short inline collections—a tag list or small record—but unreadable when nested. A common convention is block style for everything except short arrays that fit on one line.

Single versus double quotes

Block style versus flow style

Folded versus literal scalars

Anchors, aliases, and merge keys

Key/value alignment

Formatter versus linter

Multi-document files

Common mistakes

Run the numbers