Supported Syntax Features
Complete table of Cooklang syntax features supported by cooklang-parse.
Feature Support Matrix
| Feature | Syntax | Supported | Example |
|---|---|---|---|
| Ingredients | |||
| Single-word ingredient | @name | ✅ | @salt |
| Ingredient with quantity | @name{qty} | ✅ | @eggs{3} |
| Ingredient with quantity + unit | @name{qty%unit} | ✅ | @flour{250%g} |
| Multi-word ingredient | @multi word name{} | ✅ | @olive oil{2%tbsp} |
| Multi-word (no braces) | @multi word{qty%unit} | ✅ | @sea salt{1%tsp} |
| Empty braces | @name{} | ✅ | @salt{} |
| Fixed quantity (in braces) | @name{=qty%unit} | ✅ | @salt{=1%tsp} |
| Note suffix | @name{qty%unit}(note) | ✅ | @flour{100%g}(sifted) |
| Note (no amount) | @name(note) | ✅ | @butter(softened) |
| Alias syntax | @display|canonical{} | ✅ | @white wine|wine{100%ml} |
Modifier @ (reference) | @@name | ✅ | @@tomato sauce{200%ml} |
Modifier & (hidden) | @&name | ✅ | @&flour{300%g} |
Modifier ? (optional) | @?name | ✅ | @?garnish |
Modifier + (added) | @+name | ✅ | @+extra cheese{} |
Modifier - (removed) | @-name | ✅ | @-onion |
| Fraction quantity | @name{1/2%cup} | ✅ | @sugar{1/2%cup} |
| Decimal quantity | @name{0.5%cup} | ✅ | @water{0.5%cup} |
| Unicode names | @crème fraîche{} | ✅ | @crème fraîche{2%tbsp} |
| Cookware | |||
| Single-word cookware | #name | ✅ | #pan |
| Multi-word cookware | #multi word name{} | ✅ | #mixing bowl{} |
| Cookware with quantity | #name{qty} | ✅ | #pan{2} |
| Cookware note suffix | #name(note) | ✅ | #pan(large) |
| Cookware alias | #name|alias{} | ✅ | #frying pan|pan{} |
| Cookware modifiers | #&name, #?name | ✅ | #?blender |
| Timers | |||
| Anonymous timer | ~{qty%unit} | ✅ | ~{20%minutes} |
| Named timer | ~name{qty%unit} | ✅ | ~rest{5%minutes} |
| Timer without unit | ~{qty} | ✅ | ~{5} |
| Bare word timer | ~name | ✅ | ~rest |
| Metadata | |||
| YAML front matter | --- fences | ✅ | See syntax guide |
| Metadata directives | >> key: value | ✅ | >> servings: 4 |
| Nested YAML values | Objects, arrays | ✅ | tags: [a, b] |
| Frontmatter suppresses directives | Directives ignored with --- | ✅ | Matching cooklang-rs |
| Structure | |||
| Double-equals section | == Name == | ✅ | == Prep == |
| Single-equals section | = Name | ✅ | = Cooking |
| Multi-line steps | Adjacent lines | ✅ | Lines joined with spaces |
| Step separation | Blank lines | ✅ | Blank line = new step |
| Comments | |||
| Inline comment | -- text | ✅ | Mix well. -- stir gently |
| Full-line comment | -- text (on own line) | ✅ | -- This is a note to self |
| Block comment | [- text -] | ✅ | [- removed section -] |
| Notes | |||
| Note line | > text | ✅ | > Serve immediately. |
| Multiple notes | Multiple > lines | ✅ | Folded into one text block |
| Text | |||
@ in plain text | @ not followed by word | ✅ | Use @ symbol |
# in plain text | # not followed by word | ✅ | Item # here |
-- without space | Not a comment | ✅ | well--done |
| Unicode text | Accented, Cyrillic, emoji | ✅ | Full unicode support |
Spec Compliance
cooklang-parse is verified against 57 canonical test cases from the official Cooklang spec, plus 17 extended test cases for non-canonical features, achieving exact parity with the cooklang-rs reference implementation.