cook.md

Getting Started

Create a file called my-report.md.jinja anywhere in your recipe folder. The editor finds templates by extension (.jinja, .j2, .jinja2), so location is up to you — a templates/ folder keeps things tidy. Start simple:

# {{ metadata.title | default("Ingredients") }}

{% for ingredient in ingredients | sort(attribute='name') -%}
- {{ ingredient.name }}{% if ingredient.quantity %}: {{ ingredient.quantity }}{% endif %}
{% endfor %}

ingredients and metadata come from whichever recipe you render against — the template is reusable across your whole collection.

Render it

Open any .cook file, run Cooklang: Render Report… (command palette, or right-click in the open file), and pick my-report.md.jinja from the list. The rendered report opens in a side panel with print and PDF/PNG export. Edit the template, render again, and iterate.

Your own data with db() — free

For facts that aren't in the recipe — densities, prices, storage times, your own nutrition numbers — keep a db/ folder in the root of your recipe folder (or config/db/). It's a directory of YAML files, one folder per ingredient; the editor picks it up automatically:

db/
├── eggs/
│   └── meta.yml
└── flour/
    └── meta.yml

With db/eggs/meta.yml like:

density: 1.03
storage:
  shelf life: 30
  fridge life: 60

read it in a template as directory.file.key.subkey:

Density: {{ db('eggs.meta.density') }}
Shelf life: {{ db('eggs.meta.storage.shelf life') }} days

This is the save-money route: everything is plain text you maintain yourself, and it works without a subscription.

A first nutrition callCook Pro

With Cook Pro and a signed-in Cook account, templates can look ingredients up in the curated nutrition database instead:

{% for ingredient in ingredients -%}
{% set n = nutrition_for(ingredient) -%}
- {{ ingredient.name }}: {{ n.kcal }} kcal, {{ n.protein_g }} g protein
{% endfor %}

nutrition_for() reads the quantity, unit and preparation straight off the ingredient — @salmon{150%g}(cooked) resolves as 150 g of cooked salmon. If you're not subscribed, the render stops with a message telling you so — remove or guard the nutrition calls to render the rest.

Ready for more? The nutrition function reference covers totals, vitamins, allergens and confidence.