Skip to content

mourner/yeahml

Repository files navigation

yeahml

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.

Node Simply Awesome

Usage

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 elements

  • Key-value pairs (maps)
  • Lists (sequences)
  • Plain, single-quoted and double-quoted string values (including multiline)
  • Multi-line string literals (| clip, |- strip, |+ keep, > folded clip, >- folded strip, >+ folded keep)
  • Comments

No intention to support

  • Implicit typing (e.g. yes to true, numbers, timestamps)
  • Duplicate keys
  • Flow styles ({foo: bar, ...})
  • Anchors and aliases (&ref)
  • Explicit tags (!!int)
  • Complex keys (? foo : bar)
  • Explicit indent indicators (|2, >2)
  • Non-UTF-8 encodings

About

A tiny subset of YAML for JavaScript

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors