# @codemirror/lang-yaml

> YAML language support for the CodeMirror code editor

Latest version **6.1.3** (published 2026-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @codemirror/lang-yaml
pnpm add @codemirror/lang-yaml
yarn add @codemirror/lang-yaml
bun add @codemirror/lang-yaml
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 6.1.3 |
| Published | 2026-03-24 |
| First published | 2024-01-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 19 |
| Author | Marijn Haverbeke |
| Maintainers | adrianheine, marijn |
| Keywords | editor, code |

## Links

- npm: https://www.npmjs.com/package/@codemirror/lang-yaml
- Repository: https://github.com/codemirror/lang-yaml
- Homepage: https://github.com/codemirror/lang-yaml#readme
- Issues: https://github.com/codemirror/lang-yaml/issues
- npm.io page: https://npm.io/package/@codemirror/lang-yaml

## Dependencies (7)

- [@lezer/lr](https://npm.io/package/@lezer/lr.md) ^1.0.0
- [@lezer/yaml](https://npm.io/package/@lezer/yaml.md) ^1.0.0
- [@lezer/common](https://npm.io/package/@lezer/common.md) ^1.2.0
- [@lezer/highlight](https://npm.io/package/@lezer/highlight.md) ^1.2.0
- [@codemirror/state](https://npm.io/package/@codemirror/state.md) ^6.0.0
- [@codemirror/language](https://npm.io/package/@codemirror/language.md) ^6.0.0
- [@codemirror/autocomplete](https://npm.io/package/@codemirror/autocomplete.md) ^6.0.0

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 6.1.3 (latest) — 2026-03-24
- 6.1.2 — 2024-12-10
- 6.1.1 — 2024-04-12
- 6.1.0 — 2024-04-07
- 6.0.0 — 2024-01-22

## README

<!-- NOTE: README.md is generated from src/README.md -->

# @codemirror/lang-yaml [![NPM version](https://img.shields.io/npm/v/@codemirror/lang-yaml.svg)](https://www.npmjs.org/package/@codemirror/lang-yaml)

[ [**WEBSITE**](https://codemirror.net/) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/) | [**CHANGELOG**](https://github.com/codemirror/lang-yaml/blob/main/CHANGELOG.md) ]

This package implements YAML language support for the
[CodeMirror](https://codemirror.net/) code editor.

The [project page](https://codemirror.net/) has more information, a
number of [examples](https://codemirror.net/examples/) and the
[documentation](https://codemirror.net/docs/).

This code is released under an
[MIT license](https://github.com/codemirror/lang-yaml/tree/main/LICENSE).

We aim to be an inclusive, welcoming community. To make that explicit,
we have a [code of
conduct](http://contributor-covenant.org/version/1/1/0/) that applies
to communication around the project.

The initial implementation of this package was funded by [Braintrust Data](https://braintrustdata.com/).

## Usage

```javascript
import {EditorView, basicSetup} from "codemirror"
import {yaml} from "@codemirror/lang-yaml"

const view = new EditorView({
  parent: document.body,
  doc: `name: Ferdinand\nage: 93`,
  extensions: [basicSetup, yaml()]
})
```

## API Reference

<dl>
<dt id="user-content-yaml">
  <code><strong><a href="#user-content-yaml">yaml</a></strong>() → <a href="https://codemirror.net/docs/ref#language.LanguageSupport">LanguageSupport</a></code></dt>

<dd><p>Language support for YAML.</p>
</dd>
<dt id="user-content-yamllanguage">
  <code><strong><a href="#user-content-yamllanguage">yamlLanguage</a></strong>: <a href="https://codemirror.net/docs/ref#language.LRLanguage">LRLanguage</a></code></dt>

<dd><p>A language provider based on the <a href="https://github.com/lezer-parser/yaml">Lezer YAML
parser</a>, extended with
highlighting and indentation information.</p>
</dd>
<dt id="user-content-yamlfrontmatter">
  <code><strong><a href="#user-content-yamlfrontmatter">yamlFrontmatter</a></strong>(<a id="user-content-yamlfrontmatter^config" href="#user-content-yamlfrontmatter^config">config</a>: {content: <a href="https://codemirror.net/docs/ref#language.Language">Language</a> | <a href="https://codemirror.net/docs/ref#language.LanguageSupport">LanguageSupport</a>}) → <a href="https://codemirror.net/docs/ref#language.LanguageSupport">LanguageSupport</a></code></dt>

<dd><p>Returns language support for a document parsed as <code>config.content</code>
with an optional YAML &quot;frontmatter&quot; delimited by lines that
contain three dashes.</p>
</dd>
</dl>

---
_Source: https://npm.io/package/@codemirror/lang-yaml · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
