YAML Multi-Document Tool — Split & Merge YAML Documents
Understanding the Basics
A YAML file can contain multiple independent documents separated by the --- (document start) marker, and optionally terminated by the ... (document end) marker. This multi-document format is extensively used in Kubernetes where a single .yaml file commonly contains several resources — a Deployment, a Service, a ConfigMap, and an Ingress — all separated by --- markers. kubectl apply -f deployment.yaml applies all documents in sequence. Helm chart templates also use multi-document YAML for rendering multiple Kubernetes resources from a single template file. The ability to split a multi-document YAML file into its individual constituent documents, and to merge multiple single-document YAML files into one multi-document file, is essential for CI/CD pipelines, GitOps workflows, and Kubernetes manifest management. Splitting is useful when you need to apply one resource independently or pass a specific document to a tool that only accepts single-document YAML. Merging is useful when combining individually maintained resource files into a single deployment artifact. Our tool performs both operations with correct --- separator handling.
How to Use the Tool
- To split: paste a multi-document YAML (with --- separators) and click "Split". Each document is displayed separately in its own panel.
- To merge: paste multiple individual YAML documents (one per input box) and click "Merge". The tool joins them with --- separators.
- Each split document can be downloaded individually as a .yaml file.
- The merged output is a single YAML file with proper --- document separators.
- Document count is displayed (e.g., "3 documents found") to confirm correct splitting.
Key Features & Specifications
- Splits multi-document YAML into individual named documents at --- boundaries
- Merges multiple single-document YAML files into one multi-document file with --- separators
- Handles trailing ... document end markers correctly
- Individual documents can be downloaded as separate .yaml files
- Displays document index and key preview for each split document
Frequently Asked Questions (FAQ)
- Q:What is the --- separator in YAML?
- The triple-dash --- is the YAML document start marker. It separates multiple independent YAML documents within a single stream or file. Each --- begins a new document context; parsers treating the file as a multi-document stream process each section independently.
- Q:Can kubectl apply a multi-document YAML file?
- Yes. kubectl apply -f file.yaml processes every --- separated document in the file and applies each as a separate Kubernetes resource. This is the standard way to deploy multiple related resources in a single command.
- Q:What is the ... marker used for?
- The ... (triple-dot) is the YAML document end marker. It explicitly marks the end of a document within a stream. It is optional when followed by another --- document start, but required when a document ends before end-of-file in a streaming context. Most Kubernetes tooling omits ... in manifest files.