Just heads up, that not all latest language features supported in the apps yet. You can track progress at https://github.com/orgs/cooklang/projects/4
- About Cooklang
- The .cook Recipe Specification
- Conventions (shopping lists, pantry, scaling, pictures, canonical metadata)
- Advanced
- Projects Which Use Cooklang
- Syntax Highlighting
Cooklang is the markup language at the center of an open-source ecosystem for cooking and recipe management. In Cooklang, each text file is a recipe written as plain-english instructions with markup syntax to add machine-parsible information about required ingredients, cookware, time, and metadata.
Below is the specification for defining a recipe in Cooklang.
To define an ingredient, use the @ symbol. If the ingredient's name contains multiple words, indicate the end of the name with {}.
Then add @salt and @ground black pepper{} to taste.To indicate the quantity of an item, place the quantity inside {} after the name.
Poke holes in @potato{2}.To use a unit of an item, such as weight or volume, add a % between the quantity and unit.
Place @bacon strips{1%kg} on a baking sheet and glaze with @syrup{1/2%tbsp}.Now you can try Cooklang and experiment with a few things in the Cooklang Playground!
Each paragraph in your recipe file is a cooking step. Separate steps with an empty line.
A step,
the same step.
A different step.If you want to force a line break within a step, end the line with a backslash \. The backslash will be replaced with a newline character when rendered.
Lay out the @rice paper{1}.\
Top with @avocado{1/2}(sliced),\
@cucumber{1/2}(julienned),\
and @cooked shrimp{4}.This will render as multiple lines within a single step.
You can add comments up to the end of the line to Cooklang text with --.
-- Don't burn the roux!
Mash @potato{2%kg} until smooth -- alternatively, boil 'em first, then mash 'em, then stick 'em in a stew.Or block comments with [- comment text -].
Slowly add @milk{4%cup} [- TODO change units to litres -], keep mixingRecipes are more than just steps and ingredients—they also include context, such as preparation times, authorship, and dietary relevance. You can add metadata to your recipe using YAML front matter, add --- at the beginning of a file and --- at the end of the front matter block.
---
title: Spaghetti Carbonara
tags:
- pasta
- quick
- comfort food
---You can define any necessary cookware with #. Like ingredients, you don't need to use braces if it's a single word.
Place the potatoes into a #pot.
Mash the potatoes with a #potato masher{}.You can define a timer using ~.
Lay the potatoes on a #baking sheet{} and place into the #oven{}. Bake for ~{25%minutes}.Timers can have a name too:
Boil @eggs{2} for ~eggs{3%minutes}.Applications can use this name in notifications.
Beyond the core language, the Cooklang ecosystem has common conventions for file types (.cook for recipes, .menu for meal plans), shopping list configuration, pantry inventory, recipe scaling, adding pictures, and canonical metadata keys. See conventions.md for details.
To include relevant background, insights, or personal anecdotes that aren't part of the cooking steps, use notes. Start a new line with > and add your story. Applications decide whether to show notes in cooking mode, and how.
> Don't burn the roux!
Mash @potato{2%kg} until smooth -- alternatively, boil 'em first, then mash 'em, then stick 'em in a stew.Consecutive > lines make one note, and the lines are joined into one paragraph.
A note can use three kinds of Markdown formatting:
| You write | It means |
|---|---|
*text* or _text_ |
emphasis, usually shown in italics |
**text** or __text__ |
strong emphasis, usually shown in bold |
[text](destination) |
a link with the given text |
> **Make ahead:** the dough keeps *up to 3 days* in the fridge.
> See the [shaping guide](https://example.com/shaping) before you start.
> This filling also works in [Spinach pie](<./Spinach pie.cook>).They follow the rules of CommonMark 0.31.2 for emphasis and inline links. A delimiter with nothing to pair with stays as written, so *Use fine sea salt and * Day-old rice works best keep their asterisk, and _ inside a word (tomato_sauce_v2) is text. Formatting can continue from one line of the note to the next, but not into another note. A destination with spaces goes between < and >, and a title after the destination is ignored. Everything else from Markdown (lists, headings, code, images, HTML) is plain text, as are @, # and ~ inside a note. Formatting is read in notes only: steps, metadata, section names and the notes of ingredients and cookware are unchanged.
A backslash makes the next character plain text: 2\*250 g, \_name\_, \[1\]. Comments are removed before formatting is read, so a -- inside a destination needs escaping too (https://example.com/a\--b).
A parsed note is a list of text runs. Each run has a value and, when it applies, strong, emphasis and link (the destination, as written). Joining the value of every run gives the note's plain text, for places where formatting can't be shown, such as speech, search and notifications.
A destination is untrusted input. Applications open http:, https: and mailto: destinations outside the recipe, and resolve a destination without a scheme (that doesn't start with //) like a recipe reference, opening that recipe if it is in the recipe collection. They don't follow a path that leads outside the collection, and show the text of any other link (javascript:, data:, file:, //example.com, an empty destination, or a path that doesn't resolve) as plain text. See proposal 0022 for the details.
Some recipes are more complex than others and may include components that need to be prepared separately. In such cases, you can use the section syntax, e.g., ==Dough==. The section name and the = symbols after it are optional, and the number of = symbols does not matter.
= Dough
Mix @flour{200%g} and @water{100%ml} together until smooth.
== Filling ==
Combine @cheese{100%g} and @spinach{50%g}, then season to taste.Many recipes involve repetitive ingredient preparations, such as peeling or chopping. To simplify this, you can define these common preparations directly within the ingredient reference using shorthand syntax:
Mix @onion{1}(peeled and finely chopped) and @garlic{2%cloves}(peeled and minced) into paste.You can reference other recipes using the existing @ ingredient syntax. The path is relative to the root of the recipes directory, without the .cook extension:
Pour over with @./sauces/Hollandaise{150%g}.These preparations should be clearly displayed in the ingredient list, allowing you to get everything ready before you start cooking.
To mark an ingredient or a piece of cookware as optional, put ? straight after the @ or #:
Season with @salt and @?chilli flakes{1%pinch}.
Use a #?splatter guard{} if you have one.The ? is not part of the name. It works with every form of ingredient and cookware: single word (@?chives), multi-word (@?chilli flakes{}), with a quantity (@?chilli flakes{1%pinch}), and recipe references (@?./sauces/chimichurri{}). It must follow the sigil directly: @? thyme is plain text, and a ? anywhere else, as in Did you add the @salt{}?, is ordinary text.
Optionality belongs to each occurrence, not to the ingredient as a whole, so the same ingredient can be required in one step and optional in another. Required and optional amounts are listed separately instead of being added together:
Stir @parmesan{100%g} into the sauce.
Top with extra @?parmesan{50%g} before serving.This recipe needs parmesan 100 g, plus parmesan 50 g marked as optional. Optional components scale exactly like required ones.
Applications should mark optional items wherever ingredients and cookware are listed, leave optional ingredients off a shopping list unless the user chooses them (see shopping lists), and not count a missing optional ingredient as missing when matching recipes against a pantry. An optional recipe reference makes every ingredient of the referenced recipe optional.
When a recipe isn't exact, give a range: two numbers joined by a dash.
Crush @garlic{2-3%cloves} and fry in @olive oil{1-2%tbsp} for ~{2-3%minutes}.
Add @chilli flakes{1/2-1%tsp} and simmer for ~{25-30%minutes}.A range is a number, not text, so it can be scaled, added up and converted like any other quantity. Both ends must be numbers (whole numbers, decimals, fractions or mixed numbers like 1 1/2), and the unit after % applies to both. Spaces around the dash are allowed, so {2 - 3} is the same as {2-3}, and so are the en dash and em dash ({2–3}, {2—3}), which phones and word processors often type in place of -. Anything else stays text, as before: {2-}, {1-2-3}, {2-few} and {1-2 handfuls} are text quantities.
The ends are kept as written: {3-2} starts at 3 and ends at 2 (parsers may warn about it), and {2-2} stays a range.
A range scales by multiplying both ends, so for twice the servings @garlic{2-3%cloves} becomes 4–6 cloves. A locked quantity such as @salt{=1-2%tsp} doesn't scale at all. When the same ingredient appears more than once, ranges add end to end and a plain number adds to both ends: @garlic{2} and @garlic{1-2} need 3–4 garlic. Amounts in different units are listed separately, as for any quantity.
Applications should show a range with its unit once (2–3 cloves, ½–1 tsp), and write it back with a plain - and no spaces. When a range is converted to another unit, the unit is picked for the lower end and the upper end is converted to the same unit. A countdown for a timer range starts at the lower end, so the cook checks early and keeps going if needed. See conventions for ranges in shopping lists and pantry matching.
- Cooklang playground
- Obsidian plugin
- Official command line application
- Community alternative command line application
- Official iOS application
- Official Android application
- Emacs
- Nano
- SublimeText
- Vim
- VSCode
- More options: See syntax highlighting documentation.
There's a GitHub board where we show what we're working on and what's next https://github.com/orgs/cooklang/projects/4.