Cooklang Specification
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
About Cooklang
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.
The .cook recipe specification
Below is the specification for defining a recipe in Cooklang.
Ingredients
To define an ingredient, use the @ symbol. If the ingredient's name contains multiple words, indicate the end of the name with {}.
To indicate the quantity of an item, place the quantity inside {} after the name.
To use a unit of an item, such as weight or volume, add a % between the quantity and unit.
Now you can try Cooklang and experiment with a few things in the Cooklang Playground!
Steps
Each paragraph in your recipe file is a cooking step. Separate steps with an empty line.
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.
This will render as multiple lines within a single step.
Comments
You can add comments up to the end of the line to Cooklang text with --.
Or block comments with [- comment text -].
Metadata
Recipes 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.
Cookware
You can define any necessary cookware with #. Like ingredients, you don't need to use braces if it's a single word.
Timer
You can define a timer using ~.
Timers can have a name too:
Applications can use this name in notifications.
Conventions
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.
Advanced
Notes
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.
Sections
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.
Short-hand preparations
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:
Referencing other recipes
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:
These preparations should be clearly displayed in the ingredient list, allowing you to get everything ready before you start cooking.
Projects Which Use Cooklang
- Cooklang playground
- Obsidian plugin
- Official command line application
- Community alternative command line application
- Official iOS application
- Official Android application
Syntax Highlighting
- Emacs
- Nano
- SublimeText
- Vim
- VSCode
- More options: See syntax highlighting documentation.
Roadmap
There's a GitHub board where we show what we're working on and what's next https://github.com/orgs/cooklang/projects/4.