lima 0.9.0

Lima frontmatter parser — LIMA Is Metadata Annotation
Documentation

lima

crates.io version

LIMA Is Metadata Annotation — a small, predictable frontmatter format. A deliberate, focused subset of YAML: the part frontmatter actually needs, with well-defined types, no surprises, and zero runtime dependencies.

The current crate release is 0.9.0.

cargo add lima
use lima::{parse, ParseOptions};

let result = parse(r#"
title: Hello World
published: 2024-03-01
draft: false
tags:
  - javascript
  - webdev
"#, ParseOptions::default()).unwrap();

// LimaValue::Mapping — "title" a String, "published" an Instant
// (2024-03-01T00:00:00Z), "draft" a Bool, "tags" an Array of Strings.

parse/parse_core accept the raw content between the frontmatter delimiters (---) — stripping them is the caller's job.

The public entry points are:

  • parse(input, options) — Lima References 2.1 by default: ${key} reads document values and $(partial) reads supplied partials.
  • parse_core(input, options) — Lima Core 1.3 only.
  • parse_references(input, options) — deprecated References 2.1 alias for parse.

ParseOptions::default() enables References in non-strict mode. Select ParseMode::Core for the reference-unaware path. CoreOptions and ParseOptions support an optional duplicate-key warning callback.

Both return Result<LimaValue, LimaError> — LimaError implements std::error::Error and carries a stable .code field (LimaDiagnosticCode) for programmatic error handling, alongside a human-readable message.

The crate implements Lima Core 1.3 and Lima References 2.1. Rust API docs: docs.rs/lima.

Why Lima exists, the case against YAML, and security rationale: repository README.

The Lima Core 1.3 and Lima References 2.1 specifications are the normative source of truth — this crate implements them exactly, verified against the same 806-case conformance corpus (counts pinned by tests/corpus.rs and the private References 1.0 unit-test module) shared with the TypeScript implementation.

Migrating existing YAML frontmatter: docs/migrating-from-yaml.md. Static site generator integration status: docs/integrations.md.

License

ISC — see LICENSE (also included in this package as LICENSE).