# yawn-yaml

> YAML parser that preserves comments and styling

Latest version **3.0.0** (published 2026-01-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install yawn-yaml
pnpm add yawn-yaml
yarn add yawn-yaml
bun add yawn-yaml
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2026-01-16 |
| First published | 2015-10-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 151.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 107 |
| Author | Mohsen Azimi |
| Maintainers | mohsen-azimi |
| Keywords | yaml, parser, comments, preserve, formatting |

## Links

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

## Dependencies (1)

- [yaml](https://npm.io/package/yaml.md) ^2.8.2

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2026-01-16
- 2.3.0 — 2024-08-12
- 2.2.0 — 2024-04-25
- 2.1.0 — 2024-04-25
- 1.8.0 — 2024-04-25
- 1.7.2 — 2024-04-25
- 1.7.1 — 2024-04-24
- 1.7.0 — 2024-04-24
- 1.6.1 — 2024-04-24
- 1.6.0 — 2024-04-24
- 2.0.0 — 2024-04-24
- 1.5.2 — 2024-04-24
- 1.5.1 — 2024-04-24
- 1.5.0 — 2020-01-28
- 1.4.0 — 2019-03-11
- … 10 more at https://npm.io/package/yawn-yaml/versions

## README

# YAWN YAML 🥱

YAML parser that preserves comments and styling

**[Live Demo](http://azimi.me/yawn-yaml/demo/index.html)**

## Usage

```ts
import YAWN from 'yawn-yaml';

let str = `
# my comment
value: 1 # the value is here!
`;

let yawn = new YAWN(str);

// update the `json` property
yawn.json = { value: 2 };

// value in `yawn.yaml` is now changed.
// with comments and styling preserved.
console.log(yawn.yaml); // =>
// # my comment
// value: 2 # the value is here!
```

## Installation

Use npm or yarn to install [`yawn-yaml`](https://www.npmjs.com/package/yawn-yaml) package

```bash
npm install --save yawn-yaml
```

```bash
yarn add yawn-yaml
```

## Development

To install dependencies run:

```bash
yarn install
```

To run tests continuously and watch for changes

```bash
yarn start
```

To run the test run:

```bash
yarn test
```

## License

[MIT](./LICENSE)

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