@mdxld/yaml
Bi-directional conversion between Objects and YAML
@mdxld/yaml
Convert objects to YAML and back. Perfect for configuration files, Kubernetes manifests, CI/CD pipelines, and Docker Compose files.
Installation
Quick Start
Output:
API Reference
toYAML(object, options?)
Convert an object to YAML string.
Example with options:
fromYAML(yaml, options?)
Parse YAML string to object.
Example:
Multi-Document Support
YAML supports multiple documents in a single file, separated by ---.
Output:
Parsing:
Streaming Support
For large files, use streaming to avoid loading everything into memory:
Use Cases
Kubernetes Manifests
GitHub Actions Workflow
Docker Compose
Configuration Management
YAML-LD Integration
Convert between YAML-LD (MDXLD frontmatter style) and JSON-LD:
Related Packages
| Package | Description |
|---|---|
@mdxld/json | JSON and JSON-LD |
@mdxld/typescript | TypeScript and JSON5 |
mdxld | Core MDXLD parser (YAML frontmatter) |