@codemirror/lang-yaml

YAML language support for the CodeMirror 6 code editor, with highlighting, indentation, folding, and frontmatter parsing.

Library
npm
v6.1.3
19stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
20/100Needs Attention
Development Activity8
Maintenance0
Community12
Maturity48
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
57/100Fair
Architecture76
Code Quality55
Innovation62
Learning Curve35

@codemirror/lang-yaml adds YAML language support to CodeMirror 6, the extensible in-browser code editor. It wraps the Lezer YAML grammar with CodeMirror’s language extension system, providing syntax highlighting, context-aware indentation for block sequences, mappings, and literal blocks, and code folding for flow collections and multi-line items.

Beyond plain YAML, the package exports a yamlFrontmatter helper that lets any other language (Markdown, JSON, etc.) be wrapped with an optional YAML frontmatter block delimited by triple-dash lines, using CodeMirror’s mixed-language parsing to parse the frontmatter as YAML and the rest of the document with the wrapped language.

What You Get

  • yaml() language extension - A single function that returns a LanguageSupport ready to drop into a CodeMirror extensions array.
  • Context-aware indentation - Custom indent rules for block sequences, block mappings, block literals, and flow collections so pressing Enter keeps YAML properly aligned.
  • Code folding support - Flow mappings/sequences and multi-line block items and literals can be folded via CodeMirror’s foldNodeProp integration.
  • yamlFrontmatter() composer - Wrap any other language (e.g. Markdown) with an optional YAML frontmatter block using CodeMirror’s mixed-language parsing.
  • Exported yamlLanguage - The underlying LRLanguage instance for advanced use cases like custom language data or further configuration.

Common Use Cases

  • Config file editors - Embedding a YAML editor for docker-compose, GitHub Actions, or Kubernetes manifests in a web-based IDE or admin tool.
  • Markdown editors with frontmatter - Using yamlFrontmatter to give a Markdown-based CMS or note-taking app correct highlighting for the YAML metadata block at the top of a document.
  • In-browser YAML linting/preview tools - Powering a YAML playground or validator that needs accurate parsing, folding, and indentation.
  • Static site generator dashboards - Editing YAML data files (e.g. Jekyll/Hugo data/config files) directly in a browser-based content tool.

Under The Hood

Architecture The package is a thin, single-module wrapper (src/yaml.ts) around a Lezer-generated YAML parser, following the same shape as every other @codemirror/lang-* package: a compiled grammar supplies the parse tree, and the JS layer only attaches CodeMirror-specific behavior. It configures the imported Lezer YAML parser with an indentNodeProp that walks up the syntax tree from the cursor to compute indentation for BlockLiteral, BlockSequence, BlockMapping, and QuotedLiteral/Literal nodes, and a foldNodeProp for FlowMapping/FlowSequence and per-item folding of Item/Pair/BlockLiteral nodes. A second, independent language (frontmatterLanguage) is built from a hand-written Lezer grammar (src/frontmatter.grammar) that recognizes triple-dash delimiter lines, and yamlFrontmatter() composes it with any content language via Lezer’s parseMixed, dispatching FrontmatterContent to the YAML parser and Body to the wrapped language’s parser. There is little that could “break” architecturally since the design surface is two small, declarative language definitions rather than layered application logic.

Tech Stack Written in TypeScript and built with @codemirror/buildhelper (a shared Rollup-based build tool used across the CodeMirror monorepo family), the package depends directly on @codemirror/autocomplete, @codemirror/language, @codemirror/state, and the @lezer/* parser runtime and highlighting packages. The frontmatter grammar is authored in Lezer’s own grammar DSL (frontmatter.grammar) and compiled to a parser table as part of the build, rather than hand-written token logic. No test runner, bundler config, or application framework ships in the published package itself; distribution is ESM/CJS dual output (dist/index.js and dist/index.cjs) with generated type declarations.

Code Quality No test files or test directory are present in the repository, so there is no visible automated test coverage for the indentation, folding, or frontmatter-mixing logic. The code is fully typed TypeScript with consistent naming and API shape matching the rest of the @codemirror/lang-* family, and public exports carry /// doc comments that are extracted into the published README’s API reference. Error handling is minimal because the surface area is declarative configuration rather than runtime logic with failure modes; there’s no linter or CI configuration checked into this specific repo.

API Design The public API is extremely small and low-boilerplate: import yaml and call it inside an extensions array to get full YAML support, matching the zero-config convention shared by every @codemirror/lang-* package. Advanced consumers can reach yamlLanguage directly to extend language data or highlighting. The yamlFrontmatter(config) helper is a genuinely reusable composition primitive — it lets any other CodeMirror language be wrapped with optional YAML frontmatter in one call, which is more distinctive than the plain single-language wrappers most sibling lang-* packages provide.

Used by 15 apps in this directory

TypeScript
98%
Other

Dokploy

Devops · Hosting Control Panel · Security

37,130

Self-hosted PaaS that deploys apps and databases on your own VPS using Docker, Traefik, and multi-build-system orchestration

View details
88
Repo Health
76
Technical
64
Dependency
Built with
TypeScript98%
Updated 3 days ago
JavaScript
47%
MIT

Ghost

CMS · Blogging

55,191

Open source headless Node.js CMS for professional publishing, paid memberships, and newsletters with a fully owned audience.

View details
96
Repo Health
85
Technical
67
Dependency
Built with
JavaScript47%
TypeScript47%
Updated yesterday
Rust
67%
Other

GitButler

Developer Tools · Devops · AI Development

21,624

Git, but better — a modern version control client with stacked branches, parallel workflows, unlimited undo, and first-class support for AI-powered development.

View details
89
Repo Health
84
Technical
67
Dependency
Built with
Rust67%
TypeScript20%
Svelte11%
Updated yesterday
TypeScript
65%
Apache 2.0

Laminar

AI Development · Monitoring

3,230

Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.

View details
85
Repo Health
76
Technical
69
Dependency
Built with
TypeScript65%
Rust33%
Updated yesterday
Go
67%
MIT

nginx ignition

Developer Tools · Devops

2,137

A modern web UI for nginx that eliminates config file editing with visual virtual hosts, SSL automation, Docker integrations, and real-time traffic analytics.

View details
66
Repo Health
80
Technical
71
Dependency
Built with
Go67%
TypeScript30%
Updated 1 weeks ago
Go
61%
MIT

Obot

AI Agents

985

An open-source MCP platform for organizations — host MCP servers, run MCP registries, monitor usage, and build agents and chatbots on top of the Model Context Protocol from one self-hosted deployment.

View details
85
Repo Health
70
Technical
70
Dependency
Built with
Go61%
Svelte29%
Updated 3 days ago
Ruby
60%
MIT

OnetimeSecret

Security

2,920

Generate self-destructing single-use links to share passwords and sensitive data without leaving traces in inboxes or chat logs.

View details
92
Repo Health
81
Technical
73
Dependency
Built with
Ruby60%
TypeScript26%
Vue10%
Updated today
Python
74%
AGPL 3.0

OpenViking

Databases · AI Development

35,793

An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.

View details
84
Repo Health
75
Technical
65
Dependency
Built with
Python74%
Rust14%
Updated yesterday
Go
40%
Apache 2.0

Rill

Analytics · Data Engineering

2,867

The fastest BI tool for humans and agents — define metrics, models, and dashboards as code and query them instantly on ClickHouse or DuckDB.

View details
87
Repo Health
88
Technical
64
Dependency
Built with
Go40%
TypeScript37%
Svelte22%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search