Hi everyone! Gram v1.5.0 is now available.
This release goes back to basics and focuses on writing .gram files themselves, making the syntax both more natural and better suited to how real recipes are written. In a real recipe, you add measures together (1 cup + 1 tbsp), dose eggs per 100 g of flour, bake for 1h30, write 1,5 kg with a decimal comma, watch the browning, and note (fan) next to 160°C. Gram v1.5.0 brings all of this straight into the language, without breaking existing recipes and without ever guessing when an expression is ambiguous.
(To update your setup, run gram upgrade in your terminal, or npm install -g @gram-lang/cli if you are new to Gram.)
Deprecations
renderer.runSheetRangein@gram-lang/i18n: deprecated since1.5.0, will be removed in2.0.0. The run sheet and step timers now both format duration ranges throughformatDurationRange()from@gram-lang/renderer(8–16 hinstead of8 h to 16 h). See Deprecated features.
What’s new in .gram syntax
Here is a quick look at what a recipe can now express naturally:
Measuring and proportioning
- Compound quantities: ingredients, composite parents (
<@oranges{1 lb + 4 oz}), and intermediates (&dough{1 kg + 200 g}) now accept any chain of+and-terms, including fractions and ranges (@flour{1/2 cup + 1-2 tbsp},@sugar{1 cup - 2 tbsp},@butter{1 cup + 20 g}). It brings everyday kitchen phrasing—combining two measures, separating two additions, or mixing weight and spoons—straight into the syntax. Steps keep the author’s exact wording, while ambiguous cases (missing units, or mixing a percentage with a sum) are rejected rather than guessed. - Decimal commas:
{1,5 kg}and{1.5 kg}now mean the same thing across every braced number (ingredients, percentages, temperatures, timers, and section anchors). Because Gram has no thousands separator, a comma followed by three digits ({1,000 g}) is still read as a decimal (1 g) and flagged with a warning in case a thousand was meant. - Unit ratios: express quantities relative to another ingredient across units or piece counts—
@eggs{1 / 100 g @&flour},@salt{15 g / 1 L @&water}, or homemade preparations like&stock{250 ml / 100 g @&rice}(percentages on homemade preparations like&stock{250% @&rice}now work too). Compatible units resolve at compile time; cross-family ratios (mass, volume, counts) use the ingredient database.
Natural durations and proportional timers
- Natural timers and anchors: write durations the way recipes do, in English or French, with or without spaces—
~{1h30},~{1 hr 30 mins},~{1 heure 30},~{1h + 30min},~{1:30 h},~{5'30"},~{45 min - 1 h}, and section anchors like~{-1h30}or~{-1j 12h}. Genuinely ambiguous forms like~{1:30}(hours or minutes?) raise a warning with a suggested rewrite. - Proportional timers: scale a cooking time by weight or piece count with
~{15 min / 500 g @&roast}or~{4 min / @&cutlet}.
Cooking cues and temperatures
- Target states: mark inline checkpoints anywhere in a step, with an optional glued verification note:
Whisk until ={ribbon stage}(the batter falls back in a continuous ribbon).Target states render across all views without affecting scaling, scheduling, or shopping lists. - Temperature notes: attach a parenthetical note directly to a temperature’s closing brace for oven mode or probe placement—
^{160°C}(fan),^oven{180°C}(grill),^{63°C}(internal). Spaced parentheses remain plain step text.
Engine, planning, and tools
The rest of the pipeline follows these syntax additions seamlessly:
- Scaling and shopping lists: scaling multiplies every term in a sum, formats scaled amounts the way a cook measures (
2 cup + 2 tbspinstead of2 1/8 cup), and re-resolves all unit ratios along with the schedule. On the shopping list, units from the same measuring system merge onto one line (1 cupand2 tbspcombine into1 cup + 2 tbsp;1 kgand200 ginto1.2 kg), ranges add by their bounds (202-203 g), and more ingredients work withgram scale --target. - Whole-section references: using a section preparation whole (
Roll out the &dough) now estimates its mass from the producing section instead of warning that the mass is unknown. - Consistent timers and 12-hour clocks: step timers format consistently with non-breaking spaces (
1 h 30 min,45 min – 1 h) across views,gram cook, and the run sheet.gram plan, the scheduler, and the editor’s serving time now accept 12-hour input (8am-10pm,1:00 pm), with a newclocksetting (auto,12h,24h) following the reader’s region by default. - Editor, formatter, CLI, and Playground:
- Editors add quick fixes for adjacent quantities (
{1 cup 5 tbsp}→{1 cup + 5 tbsp}),ozafter a volume (fl oz), and percentage sums; hover previews for sums and natural timers; time-only completion inside~{…}; and highlighting/inlay hints for ratios and target states. gram formatspaces+/-in ingredient sums and trims trailing zeros ({1.50 kg}→{1.5 kg},{1,50}→{1,5}).gram cookshows target states under each step (and reminds you when a timer rings),gram difftracks target states, temperature notes, and formatted amounts,gram importwrites sums, natural timers, target states, and oven notes directly, andgram shop --format jsonexposes numeric amounts alongsideqty.- The Playground adds a read-only
ingredients.yamltab so you can inspect the database behind weight and nutrition calculations.
- Editors add quick fixes for adjacent quantities (
Other fixes
analyze()no longer mutates the compiled recipe’s warnings array, preventing duplicate warnings on live edits.- Percentages inside alternatives (
@butter{10% @&flour}|@oil{8% @&flour}) now resolve per option, percentages targeting step-declared intermediates (->&dough) in earlier sections are found properly, and percentages on composite parents raise a clear warning instead of being silently dropped. - Text-only quantities (
@pepper{to taste}) are preserved in steps, sections, and shopping lists, and zero-denominator fractions (@flour{1/0 cup}) raise a warning instead of being misread. - Fixed
gram plan --findhandling single-digit hours (9:00) and invalid clock times (25:99,24:30), improved narrow ingredient list wrapping, and switched the VS Code preview CodeLens label to English (▶ Preview) (yeah, this one is quite specific !).
Happy cooking, and see you soon for the next update !
For the full list of changes, check out the Changelog.