50 releases

0.18.6 Apr 12, 2026
0.18.3 Mar 3, 2026
0.17.11 Dec 22, 2025
0.17.2 Nov 17, 2025
0.5.1 Jul 24, 2023

#523 in Parser implementations

Download history 266/week @ 2026-01-18 47/week @ 2026-01-25 123/week @ 2026-02-01 227/week @ 2026-02-08 259/week @ 2026-02-15 101/week @ 2026-02-22 234/week @ 2026-03-01 537/week @ 2026-03-08 153/week @ 2026-03-15 347/week @ 2026-03-22 327/week @ 2026-03-29 384/week @ 2026-04-05 218/week @ 2026-04-12 179/week @ 2026-04-19 81/week @ 2026-04-26 52/week @ 2026-05-03

552 downloads per month
Used in 11 crates

MIT license

610KB
14K SLoC

Rust 11K SLoC // 0.0% comments Swift 2.5K SLoC // 0.2% comments TypeScript 234 SLoC

cooklang-rs

crates.io docs.rs license

Cooklang parser in rust with opt-in extensions.

All regular cooklang files parse as the same recipe, the extensions are a superset of the original cooklang format. Also, the extensions can be turned off, so the parser can be used for regular cooklang if you don't like them.

You can see a detailed list of all extensions explained here.

The parser also includes:

  • Rich error report with annotated code spans. (like this one)
  • Unit conversion.
  • Recipe scaling.
  • A parser for cooklang aisle configuration file.

lib.rs:

A cooklang parser with opt-in extensions.

The extensions create a superset of the original cooklang language and can be turned off. To see a detailed list go to extensions.

Also includes:

  • Rich error report with annotated code spans.
  • Unit conversion.
  • Recipe scaling.
  • A parser for cooklang aisle configuration file.

Basic usage

If you just want to parse a single cooklang file, see parse.

If you are going to parse more than one, or want to change the configuration of the parser, construct a parser instance yourself.

To construct a parser use CooklangParser::new or CooklangParser::default if you want to configure the parser. You can configure which Extensions are enabled and the Converter used to convert and check units.

// Create a parser
// (this is the default configuration)
let parser = CooklangParser::new(Extensions::all(), Converter::default());

Then use the parser:

let (recipe, _warnings) = parser.parse("This is an @example").into_result()?;
assert_eq!(recipe.ingredients.len(), 1);
assert_eq!(recipe.ingredients[0].name, "example");

Recipes can be scaled and converted. But the following applies:

Dependencies

~9–13MB
~219K SLoC