A JavaScript parser for a strict subset of YAML — a minimal amount necessary to be useful for static site generators and simple configuration, while being tiny, safe, unambiguous and without dependencies. Inspired by and largely follows the StrictYAML philosophy.
Install using NPM (npm install @mourner/yeahml), then import via ESM and call on a YAML source string:
import {parse} from '@mourner/yeahml';
const yamlSource = `
title: My Article
tags:
- opinion
- essay
date: 2026-03-29
version: 3`;
const result = parse(yamlSource);
// {title: 'My Article', tags: ['opinion', 'essay'], date: '2026-03-29', version: '3'}- Key-value pairs (maps)
- Lists (sequences), including flat one-line flow sequences (
tags: [foo, bar],tags: []) - Plain, single-quoted and double-quoted string values (including multi-line, folded like in YAML)
- Multi-line string literals (
|clip,|-strip,|+keep,>folded clip,>-folded strip,>+folded keep) - Comments
- Implicit typing (e.g.
yestotrue, numbers, timestamps) - Duplicate keys
- Flow mappings (
{foo: bar, ...}), nested or multi-line flow sequences - Anchors and aliases (
&ref) - Explicit tags (
!!int) - Complex keys (
? foo : bar) - Explicit indent indicators (
|2,>2) - Non-UTF-8 encodings