cook.md

Report Templates

A report template is a plain-text Jinja file that turns your .cook recipes and .menu plans into a rendered document — a shopping list, a nutrition breakdown, a week-at-a-glance summary. Templates are just files in your recipe folder, and Cook Editor renders them for you.

What you can build

  • Shopping lists — grouped by aisle, with checkboxes, from a recipe or a whole week.
  • Nutrition reports — calories, macros, vitamins and allergens per recipe or per plan. The guide Make a nutrition report for a meal plan walks through one.
  • Dietitian-style checks — assert "protein over 75 g, saturated fat under 20 g" and get a pass/fail summary. For a ready-made version, see Check a meal plan against daily nutrient targets.
  • Anything text — templates output Markdown, HTML, or plain text, so labels, meal-prep cards and cost sheets are all fair game.

How rendering works

Open a .cook or .menu file in Cook Editor and run Cooklang: Render Report… from the command palette (or right-click in the file's source view; the preview has no such menu entry). The editor lists every template in your folder plus two built-ins — Ingredients List and Shopping List — renders your pick in its own tab, and lets you print it or export it as PDF or PNG.

The template's file name decides the output: report.md.jinja (or a plain report.jinja) renders as Markdown, report.html.jinja as HTML, and other inner extensions as plain text.

Outside the editor, released CookCLI (0.41.1) renders plain templates with cook report. It has no nutrition functions and no plan value, and it reads a db/ folder only when you pass -d db.

Two ways to get data into a report

Every template sees your recipe's ingredients out of the box, and a few free functions work on them: aisled() groups ingredients by the aisles in config/aisle.conf, and excluding_pantry() and from_pantry() split them by what's in config/pantry.conf. For data beyond the recipe itself, there are two routes:

  • Your own local database — free. Keep a db/ folder of YAML files next to your recipes (densities, prices, shelf lives, even nutrition facts you enter yourself) and read it with the db() function. You maintain the data; it lives in plain text on your disk like everything else.
  • Nutrition functions with Cook Basic or Cook Pro. nutrition_for() and friends look ingredients up in a curated nutrition database built from USDA and other reference sources, with unit and preparation conversion, allergen data, and honest confidence reporting. This needs a Cook Basic or Cook Pro subscription; accounts from before the paywall don't have the nutrition service. Requests that templates send to it count against your nutrition API daily quota (Cook Basic 1,000 requests a day, Cook Pro 5,000; see Nutrition API). If you'd rather save the money, the local db() route works with any template.

Next steps