YAML-opmaker en -validator
Mooi afdrukken, valideren en opnieuw inspringen van YAML — multi-documentbestanden ondersteund.
Snel antwoord: YAML-opmaker en -validator: YAML overzichtelijk opmaken, valideren en opnieuw inspringen — bestanden met meerdere documenten worden ondersteund. Werkt volledig in je browser, gratis en zonder registratie.
Laatst bijgewerkt
Goed om te weten
YAML's whole appeal is human readability, and that hinges entirely on indentation — a single stray space can move a key into the wrong parent and change the meaning of a Kubernetes manifest or a CI workflow without any visible error. Running a file through this formatter re-emits it with consistent indentation and no trailing whitespace, so structural mistakes that were hiding in ragged spacing become obvious.
It validates as it goes: if the document can't be parsed, you have a real structural problem to fix before deploying, which is far cheaper to catch here than in a failed pipeline run. Multi-document files separated by --- are handled correctly, with each document parsed and re-emitted on its own — the common shape for Kubernetes bundles.
The trade-off to know about is comments. The standard JavaScript YAML parser treats data as data, and comments aren't part of the data model, so they are dropped on reformat. If your YAML relies on inline documentation, keep a commented master copy or use a comment-preserving desktop formatter for that file.
Don't be surprised when some strings come back quoted — values that look like booleans, versions, or that start with a dash need quoting to stay valid, and the emitter adds quotes only where the spec demands. To move the data into JSON, hand it to the JSON ↔ YAML converter.
Veelgestelde vragen
- Welke YAML-versie ondersteunden jullie?
- YAML 1.2 via js-yaml, plus YAML 1.1 eigenaardigheden waar ze niet conflicteren (bijv. booleaanse verkortingen). Ankers en aliassen worden bewaard.
- Overleven mijn opmerkingen de opmaak?
- Nee — js-yaml laat opmerkingen vallen omdat de YAML-specificatie ze niet als onderdeel van de datastructuur modelleert. Als je opmerkingen wilt bewaren, gebruik dan een desktoptool zoals prettier-plugin-yaml.
- Hoe behandelen jullie meerdere documentbestanden?
- Elk document wordt apart geparsed en opnieuw uitgegeven, met <code>---</code> scheidingstekens ertussen. De structuur van elk document wordt volledig behouden.
- Zijn mijn bestanden geüpload?
- Nee — js-yaml draait volledig in je browser.
- Waarom voegt het sommige van mijn strings opnieuw aan?
- Strings die speciale tekens bevatten (doubles-punten, leidende streepjes, versie-achtige nummers) moeten geciteerd worden volgens de YAML-specificatie — js-yaml voegt alleen citaten toe waar nodig om het bestand geldig te houden.