53 KiB
@gram-lang/renderer
1.5.1
Patch Changes
9af07c9: Renderer, CLI & i18n: Displayed quantities now round by significant digits rather than a fixed decimal per unit, fixing inaccurate or zeroed amounts introduced in 1.4.0:- Amounts keep three significant digits (two below 1) without truncating whole numbers (
0.15 kgstays0.15 kg,0.02 kgno longer reads0), while kitchen fractions stay unchanged. - Weights in grams keep one decimal from
1 gupwards and no longer render as0 gbelow0.05 g. - Adds
formatAmount,roundAmount, andamountDecimalsin@gram-lang/i18n.
- Amounts keep three significant digits (two below 1) without truncating whole numbers (
- Updated dependencies [
9af07c9] - Updated dependencies [
d3b2c04] - Updated dependencies
- Updated dependencies
- Updated dependencies
- Updated dependencies [
6abae89] - Updated dependencies [
3080adf]- @gram-lang/i18n@1.5.1
- @gram-lang/kitchen@1.5.1
- @gram-lang/parser@1.5.1
- @gram-lang/analyzer@1.5.1
- @gram-lang/scheduler@1.5.1
1.5.0
Minor Changes
-
9c86b70: Scheduler, Renderer & CLI: Clock times can now be entered and displayed in 12-hour (1:00 PM) as well as 24-hour (13:00) format:--available,--meal-times,--serve,--find, theiravailabilityandmealTimessettings, and the editor's serving time accept 12-hour times in any case or spacing (8am-10pm,fri=6pm-12am,12:30pm,8pm,"2026-10-11 1:00 pm"), rejecting invalid forms like13pm,0am, or bare hours.- Adds a
clockview setting (auto,12h,24h) controlling time formatting in the run sheet, serving-time suggestions, and iCalendar descriptions;auto(default) follows the reader's locale region rather than the recipe language. - Configurable via
--clock(gram plan,gram export,gram print),clockin.gram/config.yaml(or global config),gram.clockin VS Code, and the playground's Display menu. - Adds
localesupport toprepareViews(), anhourCycleoption to run sheets, clock helpers (formatClock,chooseClock,resolveHourCycle,systemLocale) in@gram-lang/renderer, andparseTimeOfDay/parseLocalDateTimein@gram-lang/scheduler(JSON and ISO data remain unchanged).
-
073d4f1: Parser & Kitchen: An ingredient or intermediate quantity can now be written as a sum or difference of terms (@flour{1 cup + 1 tbsp},@sugar{1 cup - 2 tbsp},@butter{1 cup + 20 g},&dough{1 kg + 200 g}):- Supports any number of
+/-terms (including fractions and ranges) on ingredients, composite parents (<@oranges{1 lb + 4 oz}), and intermediates (including@usebase yields); scaling multiplies each term, andgram importnow preserves multi-measure sums instead of folding them into decimals. - Steps and section ingredient lists keep sums as written (
100 g + 100 g), while scaled amounts format cleanly for cooking (2 cup + 2 tbsp,2.4 kg); compiled JSON stores terms inparts(withminus: truefor subtraction) and totals inqty/unit(or full text inunitfor mixed unit kinds). - Invalid sums (missing unit, percentage, multiplication, subtracting a range or across unit kinds, zero total) raise
INVALID_QUANTITYwith a suggestion indata;OZ_AFTER_VOLUMEflagsozafter a volume ({1 cup + 2 oz}), andINVALID_UNITsuggests a sum for adjacent quantities ({1 kg 200 g}). - Masses and nutrition weigh each term individually (returning no mass if any term cannot be weighed),
gram diffshows formatted quantities viafromText/toText,@gram-lang/rendererexportsformatUsageQuantity, and@gram-lang/i18nexportstermsTotal,mergeTerms,formatTerms, andTerm.
- Supports any number of
-
a9e6231: Kitchen & Rendering: The shopping list merges repeated quantities of an ingredient wherever possible:- Units from the same measuring system combine onto one line in natural cooking units (
1 cupand2 tbspbecome1 cup + 2 tbsp;1 kgand200 gbecome1.2 kg), reducing mixed-unit warnings and supportinggram scale --target. - Different measuring systems (
1 cupand100 ml) or unit kinds (volume and weight) stay on separate lines. - Ranges add by their bounds (
2-3 gand200 gbecome202-203 ginstead of202.5 g). - In compiled JSON, merged entries store the total in the smallest unit written (
18 tbsp,1200 g) and, for ranges, keep the midpoint inqtyalongside a newrangefield.
- Units from the same measuring system combine onto one line in natural cooking units (
-
f91ec4e: Parser & Kitchen: Steps can now mark inline target states with an optional glued verification note (Whisk until ={ribbon stage}(the batter falls back in a continuous ribbon).):- Only the state sits inside
={…}, with an optional single-line note attached to}; unclosed or empty={raises a syntax error, and braceless@ingredientnames end before a target state (@salt until ={taste}). - Compiled steps emit a
checkpointtoken (state, plus optionalnote) without affecting scaling, scheduling, or the shopping list. - Rendered across HTML, Markdown, plain text, and print views;
gram cookshows checkpoints below each step and reminds you when a step timer rings. gram difftracks added, removed, and changed target states,gram importpreserves them from sources, and editors highlight them.
- Only the state sits inside
-
238e012: Parser & Kitchen: Temperatures can now carry a glued parenthetical note for oven mode or probe placement (^{160°C}(fan),^oven{180°C}(grill),^{63°C}(internal),^{high heat}(covered)):- Only parentheses touching
}on the same line are parsed as a note; spaced parentheses remain plain step text. - Displayed alongside the temperature in HTML, Markdown, plain text, print, and
gram cook(which now formats temperatures consistently, including word-based ones like^{high}). - Adds an optional
notefield on AST and compiled JSON temperatures, tracks note changes ingram diff, and exportsformatTemperaturefrom@gram-lang/renderer. gram importpreserves oven modes as temperature notes rather than leaving them in prose.
- Only parentheses touching
-
0fa8c95: Rendering: Timers in steps now format durations consistently with the rest of the page using non-breaking spaces (~{90min}and~{1h30}display as1 h 30 min, ranges as45 min – 1 hor1–2 h), across views,gram cook, and the run sheet, via the newformatDurationRangeandformatTimerDurationhelpers and theformatDurationoption.Deprecated
@gram-lang/i18n:runSheetRangein the renderer dictionary ("{min} to {max}"), no longer used by the run sheet, will be removed in 2.0.0. UseformatDurationRange()from@gram-lang/rendererinstead.
-
d5fe9c3: Parser, Kitchen & Analyzer: Ingredients, intermediates, and timers can now be written as unit ratios:- Supports ratios across units or counts on ingredients (
@eggs{1 / 100 g @&flour},@salt{15 g / 1 L @&water}), homemade preparations (&stock{250 ml / 100 g @&rice}, plus percentages like&stock{250% @&rice}), and proportional timers (~{15 min / 500 g @&roast},~{4 min / @&cutlet}). - Resolves compatible units at compile time and cross-family ratios via the ingredient database; incompatible or zero-denominator ratios raise
RELATIVE_QUANTITY_UNKNOWN_MASS(withreason) orINVALID_QUANTITY(reason: "zeroRatioDenominator") instead of guessing. - Whole-use references to a section preparation (
Roll out the &dough) now estimate mass from the producing section, while step-produced intermediates (Mix … ->&dough) require an explicit amount (reason: "stepProducer"); warnings and formulas in imported bases display original author names rather than internal aliases. - Scaling a recipe re-resolves all ratios and recomputes the schedule, total times, and shopping list.
- Views display resolved ratios in tooltips, and the language server provides syntax highlighting, target completion, intermediate renaming, hover previews, and inlay hints.
- Supports ratios across units or counts on ingredients (
Patch Changes
80fbc22: Rendering: Narrow ingredient lists now switch to a single column before stacking amounts below ingredient names.4d4b12e: Kitchen & Rendering: Fixed text-only quantities (@sel{une pincée},@pepper{to taste}) disappearing from steps, section ingredient lists, and shopping lists (stored invariable_entriesin compiled JSON).- Updated dependencies [
aa78c53] - Updated dependencies [
9c86b70] - Updated dependencies [
073d4f1] - Updated dependencies [
e0f8fbf] - Updated dependencies [
8d1b62e] - Updated dependencies [
7d15360] - Updated dependencies [
f4c6943] - Updated dependencies [
a9e6231] - Updated dependencies [
92bec33] - Updated dependencies [
f91ec4e] - Updated dependencies [
238e012] - Updated dependencies [
4d4b12e] - Updated dependencies [
0fa8c95] - Updated dependencies [
55188fc] - Updated dependencies [
d5fe9c3] - Updated dependencies [
4d5f79f]- @gram-lang/analyzer@1.5.0
- @gram-lang/scheduler@1.5.0
- @gram-lang/parser@1.5.0
- @gram-lang/kitchen@1.5.0
- @gram-lang/i18n@1.5.0
1.4.2
Patch Changes
3ecc785: Kitchen, Analyzer, Renderer & CLI: Fixed lost, split, or skipped ingredient quantities across shopping lists, views, and diffs:- Shopping lists now merge different spellings of the same unit (
1 cupand2 cups,1 c.à.sand2 tbsp) onto a single line, which also makes those ingredients work again withgram scale --target. - The HTML view now displays every quantity when an ingredient uses multiple units in the same section (
100 g + 1 cup), instead of showing only the first. gram shopno longer drops ingredients whose quantity cannot be computed (such as a percentage of a missing intermediate) and lists them as written.gram diffnow compares each unit separately when an ingredient appears in multiple units, and ignores changes that only affect how a unit is spelled.
- Shopping lists now merge different spellings of the same unit (
229f017: Renderer: Fixed a missing space between two consecutive elements in a step, such as an ingredient followed by a timer or cookware (@flour{500 g} ~{1h}rendered as "flour (500 g)1 h"), across all views andgram view.- Updated dependencies [
6620c24] - Updated dependencies [
3ecc785]- @gram-lang/parser@1.4.2
- @gram-lang/kitchen@1.4.2
- @gram-lang/analyzer@1.4.2
- @gram-lang/i18n@1.4.2
- @gram-lang/scheduler@1.4.2
1.4.1
Patch Changes
2327de6: Renderer: TheformatFractionrenderer option is now applied to ingredient quantities in recipe views (steps, section ingredients, and the shopping list); it was previously documented but ignored.7de7b3f: Renderer: In the HTML recipe, hovering a preparation (&dough) now highlights the whole section that makes it, not only its title.7fbd5c6: Renderer & CLI: Totals where you buy or read an overview (shopping list, recipe/section weight, nutrition base,gram shop) convert metric amounts from 1000 g/ml up tokgorl(3.9 kginstead of3900 g), while steps, section ingredients, the run sheet, andgram cookkeep grams for weighing (API helpers:toLargerMetricUnit,isMetricMassUnitin@gram-lang/i18n).2327de6: Renderer & CLI: Numbers follow the recipe's language (lang/ projectlanguage, with decimal commas in French and no thousands separators ingram shop/gram scale), and spoons, cups, and imperial measures display as fractions (1 3/4 cup) across views and CLI commands while keeping machine attributes unchanged (API helpers:formatNumber,localizeDecimals,toKitchenFractionin@gram-lang/i18n).7fbd5c6: Renderer: An ingredient written in kilograms or milligrams no longer shows its standardized mass again next to it (3 kg, 3000 gis now3 kg), as was already the case for grams.- Updated dependencies [
7fbd5c6] - Updated dependencies [
2327de6] - Updated dependencies [
d946b46] - Updated dependencies [
4608f96] - Updated dependencies [
efbb381]- @gram-lang/i18n@1.4.1
- @gram-lang/analyzer@1.4.1
- @gram-lang/parser@1.4.1
- @gram-lang/kitchen@1.4.1
- @gram-lang/scheduler@1.4.1
1.4.0
Minor Changes
-
Run sheet: A new run sheet shows what the scheduler computed, and replaces the Gantt chart as the view of the schedule:
runSheetToText,runSheetToMarkdown,runSheetToHTMLandrunSheetToPrintHTMLwrite the plan: the days of the recipe, then for each visit to the kitchen a worksheet in three parts: the mise en place (what to take out, with the weights, the preparations made before and the bases in stock), the execution (the steps of each section, numbered as in the recipe) and what to do on leaving (what goes on afterwards, and when to come back)- Each visit says how early it could be done ("Possible from 18:00") or which wait holds it in place, and a wait the plan stretched or shortened is reported on its day
- A recipe with no serving time is told in days before the service (D-2, D-1, day D); the printed plan has one day per page, with boxes to tick for the mise en place
- The recipe views no longer carry schedule details: the run sheet is its own view. For developers,
describeRunSheet()gives the same plan in words
Deprecated
- Renderer: the Gantt chart (
toGanttHTML,attachGanttInteractivity,formatTime,formatAxisTime, theGantt*types),@gram-lang/renderer/gantt.cssand thegantt_*strings of the playground, removed in 2.0.0. No Gram surface draws it any more. Use the run sheet (runSheetToHTML), or build a view of your own from the data ofrunSheet();toGanttHTMLwarns once on the console. The Deprecated features page shows how: https://gram-lang.org/docs/how-to/deprecations/
-
Renderer / Mise en place: The mise en place can now be planned right before each section, all at the start, or at the start of each working day:
- New
miseEnPlaceoption ("perSection"by default,"upfront"or"perDay") on the HTML, Markdown and print outputs, and a newrestsoption ("shortest"by default,"balanced"or"longest") for the waits written as a range (~_{12-24h}) - The total time follows the chosen schedule, and its tooltip explains how it adds up (preparation, active time and waits), then points to the run sheet for the hour-by-hour plan
- The recipe no longer shows the waiting time on its own, in any format: it is counted in the total time, and the run sheet is where the waits are planned
- New
-
Renderer / Settings: The renderer now describes, in one place, every setting a reader can choose about a recipe, so that tools built on Gram can offer the same choices as the command line, the editor and the playground:
VIEW_SETTINGSlists what the views show (mise en place, rests, comments, nutrition basis, baker's percentages only, quantities in the steps) andRECIPE_SETTINGSwhat the analyzer computes (baker's percentages, weights in grams, preparation losses, nutrition), each with its values, its default and a short descriptionparseViewSettings()andparseRecipeSettings()read them from any configuration object, and fall back on the default for anything missing or unknown, so a mistyped setting never blanks a viewviewSettingsToRendererOptions()andrecipeSettingsToAnalyzerOptions()turn them into the options of the renderer and of the analyzer
-
Comments: You can now choose whether the comments of a recipe (
// like this) are shown or left out, in every view:- The renderer takes a new
comments: "show" | "hide"option (default"show") that the recipe views, the print and the run sheet follow; hiding leaves no empty notes section behind gram export,gram printandgram planaccept--comments <show|hide>, and the editor has a newgram.commentssetting for the preview and the run sheet; the playground gets a Display section with a switch- In the run sheet, a note alone on a line sits under its step in small muted text, and one at the end of a line stays in the sentence, between parentheses
- The renderer takes a new
-
Renderer / HTML recipe: The HTML recipe has a new design, and the printed recipe follows it:
- A better organized header (title, description, author, source, tags), a summary bar with the portions, the yield, the mass and the energy, and a bar for the times
- Tooltips that stay readable wherever they open in the window, with more practical information: quantity, weight and how it was estimated, preparation, what a part is taken from
- A more interactive recipe: hover an ingredient or a piece of cookware to see the steps that use it, tick the steps off, and follow what a step makes to the steps that use it
- The printed recipe (
gram print,gram export --format html) now looks like the one on screen, in black and white, with boxes to tick - Each view keeps its own styles (
@gram-lang/renderer/gram.cssis imported as before and relies on the CSS@scoperule, supported by every current browser), so one view can no longer change another
Deprecated
- Renderer: the
interactiveScalingoption oftoHTML(), and thedecreasePortions,increasePortionsandeditPortionsstrings of@gram-lang/i18n, removed in 2.0.0. The portions stepper they draw only works where the page around the recipe handles its buttons, so it did nothing in an exported file or an editor preview. Scale the recipe before rendering it instead (applyScale()of@gram-lang/kitchen): the recipe then shows its portions and its scale factor by itself. The option keeps working until 2.0.0
-
Renderer / Nutrition: The nutrition of the HTML recipe is now a compact table, like a European food label, and easy to reach from the top of the recipe:
- One column per basis, side by side (per 100 g, then per portion), with the energy as the first row in kJ and kcal and the whole recipe underneath; no more switching between bases
- A
%RIcolumn gives each nutrient's share of the reference intake of an average adult (8,400 kJ / 2,000 kcal), per portion - The hero bar shows the energy (
493 kcal per portion, or per 100 g when the recipe declares no portions); clicking it jumps to the table - Sodium is now shown as salt, in grams (sodium × 2.5), and calories as energy, in every view and every language
- With the
nutritionBasissetting set to one basis, the table and the hero bar show that basis alone - The Markdown and plain text recipes show the same table by default, instead of the values per portion only
Deprecated
- Renderer: the
interactiveNutritionoption no longer has any effect, since every basis is shown at once, and is removed in 2.0.0. Remove it from your calls
-
Renderer / Quantities: Quantities read the same in every format, on screen and on paper:
- The quantity is written after its ingredient in the text of each step in the HTML views and the print, as Markdown already did, so a printed recipe shows them too, and the weight in grams is written next to the quantity as written in the recipe whenever it tells something more (
flour (250 ml, ~148 g), butsugar (100 g)), in Markdown as well - Hiding the quantities of the steps (
hideStepQty) now works in the HTML views and the print, not only in Markdown
- The quantity is written after its ingredient in the text of each step in the HTML views and the print, as Markdown already did, so a printed recipe shows them too, and the weight in grams is written next to the quantity as written in the recipe whenever it tells something more (
-
Renderer / Durations: Durations read more naturally, in the reader's language:
- A duration of a day or more is written in days and hours (a recipe of 25 hours shows
1d 1h,1j 1hin French), and minutes are writtenmin(1h 30min), in every view; the total time tooltip ends on the exact total (= 25h 6min) formatDuration()takes the language as an optional second argument and{ days: false }as a third, and a newdurationUnitsentry of@gram-lang/i18nholds the units of each language
- A duration of a day or more is written in days and hours (a recipe of 25 hours shows
-
Renderer / Text: The recipe can now be written as plain text, for a terminal or a plain file:
- A box with the title, the servings and the times, then the shopping list, the cookware, each section with its numbered steps, the notes and the nutrition, in the reader's language and following the same settings as the other formats
gram export --format textwrites it next to the recipe (brioche.txt), and the playground offers it as a format of the recipe; for developers,toText()and thetextformat of the recipe view- The Markdown, HTML and print versions of the recipe now speak the reader's language too: "Instructions", "Ingredients", "or", "optional" and the other words that were always in English follow the language setting (the English output is unchanged)
-
Renderer / Views: A new
prepareViews()gathers everything a view of a recipe is built from, worked out once and only when a view asks for it (the timeline, the run sheet, the serving time search):viewslists the views of a recipe (the recipe, the run sheet) with the formats each one offers, the settings it follows and what it needs worked out, andrender(view, input, format)writes one of them;toHTML,runSheetToHTMLand the other functions stay as they areinspectorslists the looks at the pipeline (the composed AST as an S-expression, the analyzed recipe as JSON or as a folding tree) andoutputslists the views and the inspectors together, for an interface that offers bothdescribeError()picks the error to show when a recipe stops compiling and gives its code, message, file, position and a title in the recipe's language, so every interface reports it the same way, andsuggestServeTimes()puts the serving time search in words
Patch Changes
- Renderer / Markdown: The Markdown recipe is tidier: the headings and alerts have no more emoji prefixes, a blank line separates the notes from the nutrition, and temperatures show a thermometer (
🌡️ 180 °C,🌡️ fridge) instead of a flame. - Updated dependencies
- Updated dependencies
- Updated dependencies
- Updated dependencies
- Updated dependencies
- Updated dependencies
- @gram-lang/scheduler@1.4.0
- @gram-lang/kitchen@1.4.0
- @gram-lang/analyzer@1.4.0
- @gram-lang/i18n@1.4.0
- @gram-lang/parser@1.4.0
1.3.0
Patch Changes
-
4c9652c: CLI / View: Fixed several display issues ingram viewand cook mode:- Timers now show their real unit (
~{1h}is shown as~1h,~{20s}as~20s) instead of always "min". - Recipe durations are rounded and readable (
1h 5m,25m 5s) instead of raw decimals like1h4.5. - The resting time now appears in the recipe header.
- Common fractions such as
1/4 tspstay fractions in the shopping list instead of becoming0.3.
- Timers now show their real unit (
-
95698cc: Modules & Rendering: Intermediates declared inside imported modules now show the name you wrote (for examplepressed) instead of an internal path liketofu$marinated$pressed, ingram view, HTML and Markdown output. -
Updated dependencies [
48c856d] -
Updated dependencies [
95698cc] -
Updated dependencies [
fac320b]- @gram-lang/analyzer@1.3.0
- @gram-lang/parser@1.3.0
- @gram-lang/kitchen@1.3.0
- @gram-lang/i18n@1.3.0
1.2.1
Patch Changes
532ea55: Renderer: Switched icons to embedded inline SVGs, removing external CDN dependencies (unpkg.com) and enabling full offline previews in VS Code.728e2ba: CLI / Export: Fixed missing ingredient quantities ingram printand HTML exports (gram export --format html).- Updated dependencies [
c8c4d49]- @gram-lang/i18n@1.2.1
- @gram-lang/analyzer@1.2.1
- @gram-lang/kitchen@1.2.1
- @gram-lang/parser@1.2.1
1.2.0
Minor Changes
2bab3cd: Parser & Kitchen: Introduced modular recipes and multi-file imports via the@usedirective:- Import external base recipes directly into a recipe using
@use "./bases/shortcrust-pastry.gram" as &shortcrust. - Imported steps seamlessly interleave into the global ALAP scheduling timeline, preserving resting times and dependencies.
- Automatically scales imported base quantities when referenced with specific yields (e.g.
&shortcrust{250g}halves a 500 g base recipe). - Supports destructured multi-yield imports (e.g.
@use "./bases/tart-elements.gram" as { &crust, &frangipane }) scaling each component independently. - Supports multi-word bindings using bracket notation (e.g.
@use "..." as &pastry dough{}). - Resolves project-root paths (
@/bases/...) and custom path aliases defined underpaths:in.gram/config.yaml. - Added
--stockCLI flag to treat pre-made base imports as stock items (zero timeline overhead, single shopping list line, retaining full nutritional totals). - Supports retro-planning timeline offsets directly on
@useimport lines (e.g.@use "./bases/levain-starter.gram" as &starter ~{-2d}). - Spliced sections in HTML, Markdown, and print outputs display origin badges crediting their source module.
gram diffandgram watchnow track import additions, removals, rebinding, rescaling, and dependency file changes.- Language Server and VS Code extension support live dependency composition, Go to Definition into base files, path auto-completion, and quick-fix diagnostics for missing exports.
- Exported
createMemoryHostfrom@gram-lang/modulesfor browser and in-memory module graph resolution. - Corrected whole-recipe mass and nutrition totals to accurately include spliced intermediate (
-> &) masses. - Normalized rescaled ingredient quantities to one decimal place for display consistency across all outputs.
- Import external base recipes directly into a recipe using
Patch Changes
8a4056b: Language Server: Normalized error states and unified diagnostic handling across Playground and VSCode extensions:- Unified Playground diagnostics into a centralized full-width debug console with filter pills and interactive jump-to-location navigation.
- Added mobile segmented tab navigation (
[Editor]/[Preview]) and responsive single-row toolbar layout for mobile viewports. - Resolved nutrition diagnostics disconnection in the analyzer by merging physical and nutritional warnings into primary compiler warnings — the editor only turns these into squiggles when they carry a real position, so an incomplete-nutrition notice no longer misplaces itself at the top of the file.
- Markdown and print HTML exports keep their explicit "incomplete data" note next to the affected nutrition figures; the interactive HTML preview conveys the same gap through its coverage badge instead.
- A scale-target that fails to resolve (e.g. an unconvertible unit) now correctly turns the Playground's status badge and error panel red instead of being undersold as a warning, without marking the file tab as if the recipe itself had a syntax error.
- The Playground diagnostics console no longer gets stuck filtered on a category that just emptied out (e.g. after fixing the warning it was showing).
- Resolved silent compilation failures in the Language Server by capturing pipeline exceptions and pushing actionable error notifications to webviews — including when the thrown error carries no message, which previously slipped past the check silently.
- A compile-time failure (parses fine, but
compile()/analyze()throws) now also surfaces as an editor diagnostic, not only as a webview notification, so it's still visible with the preview panel closed. - Added bidirectional webview messaging in the VSCode extension to jump directly to error offsets in the active editor.
- Localized the Playground diagnostics console's collapse/expand tooltip, previously hardcoded in French regardless of site locale.
- Updated dependencies [
9331a4b] - Updated dependencies [
c31a583] - Updated dependencies [
f617b4c] - Updated dependencies [
2bab3cd] - Updated dependencies [
8a4056b] - Updated dependencies [
aaf8cee]- @gram-lang/kitchen@1.2.0
- @gram-lang/i18n@1.2.0
- @gram-lang/parser@1.2.0
- @gram-lang/analyzer@1.2.0
1.1.0
Minor Changes
fbb7511: Nutrition & Rendering: Support flexible nutrition serving bases (per portion and per 100 g) alongside whole-recipe totals:- Declaring
portions:in recipe frontmatter now calculates per-portion nutrition and keeps values constant when scaling recipes. - Added a standardized
per-100gnutrition basis calculated from raw assembled recipe mass. - Added the
--nutrition <auto|total|per-portion|per-100g>option togram view,gram export, andgram print. - Added nutrition basis toggles in the web playground and VS Code live preview.
- Localized all nutrient names and table headers across supported languages (French and English).
- Declaring
Patch Changes
- Updated dependencies [
b3a509a] - Updated dependencies [
fbb7511] - Updated dependencies [
fbb7511] - Updated dependencies [
fbb7511]- @gram-lang/parser@1.1.0
- @gram-lang/kitchen@1.1.0
- @gram-lang/analyzer@1.1.0
- @gram-lang/i18n@1.1.0
1.0.1
Patch Changes
- @gram-lang/analyzer@1.0.1
- @gram-lang/kitchen@1.0.1
- @gram-lang/parser@1.0.1
- @gram-lang/i18n@1.0.1
1.0.0
Major Changes
-
Gram v1.0.0 Official Launch! 🎉
This milestone release marks the official 1.0.0 launch of Gram:
- Brand-New Website & Documentation: Rebuilt using Astro and Starlight with refined guides and an integrated blog.
- Refreshed Visual Identity: Brand-new logo.
- Infrastructure & Stability: Monorepo stability, test coverage, and migration to self-hosted Forgejo (
git.gram-lang.org) mirrored to GitHub and Codeberg.
1.0.0-beta.5
Minor Changes
-
2ed4707: The Markdown, HTML, and printable/PDF outputs now show the same information consistently:- Markdown recipes now include a nutrition summary (calories, carbs, protein, fat, etc.), which was previously only shown in HTML and print.
- Recipe comments now appear as numbered footnotes in Markdown and print output too, instead of only in HTML.
- When a shopping-list ingredient's purchasing weight differs from what actually goes in the bowl (e.g. "1 avocado" vs. its usable flesh), Markdown and print now show the extra "gross weight" note, matching HTML.
- When the same ingredient appears in incompatible units that can't be combined (e.g. "100g" and "1 cup" with no density available), Markdown and print now group them together with a "mixed units" warning, matching HTML.
-
938afcd: Add an interactive Gantt Chart view to the VS Code extension and export reusable Gantt chart rendering helpers (toGanttHTML,attachGanttInteractivity) from@gram-lang/renderer. Provides a real-time timeline visualization of recipe steps, background timers, and target serving times directly in your editor and the web playground.
Patch Changes
7b246ae: Removed all uses ofanyfrom the physical/nutrition analysis layer's internal types, typing them against the real shapes already exported by@gram-lang/kitchenand this package's ownAnalyzedUsage/NutritionItem. No behavior change for this package beyond the fixes already released separately (see the relative-quantity type changeset). The renderer's printable/PDF view gained one internalanyto stay compatible with the analyzer's now-stricter shopping-list type — purely a type-level adjustment, no output change.19a9f19: ThehideStepQtyrendering option (hides ingredient quantities from step text) now works withtoHTMLandtoMarkdown, not justtoPrintHTML— it was previously silently ignored by the other two.73fde5e: Fixed an HTML injection vulnerability (XSS) intoHTML's timing-card tooltips: a section title or named timer containing HTML would render unescaped in the "Active Time" / "Total Time" tooltips, exploitable via the playground or the VS Code preview. Both are now properly escaped like every other text field.3fae598:toHTML,toMarkdown, andtoPrintHTMLnow type theirdataparameter instead of acceptingany. Typing it surfaced two real bugs, now fixed: the HTML nutrition panel's "incomplete data" warning was never actually shown (it read a field that never existed, always showing a blank 0-calorie panel instead), and the printable/PDF view displayed sodium in grams instead of milligrams (1000x too high).a55dca8:toMarkdownnow neutralizes raw HTML (<and&) in recipe titles, ingredient names, and step text. Previously, a recipe containing something like<img onerror=...>in its title would pass through untouched, which could run as a script if that Markdown was later converted to HTML — this is now escaped automatically, closing that gap for imported or shared recipes.d61d786:QuantityValueAST(the parser's internal representation of a parsed number/fraction/range) is now a proper discriminated union instead of a flat interface with every field optional. This is an internal type-safety improvement with no behavior change — it's what would have caught, at compile time, a real bug fixed earlier indiffRecipes(checkingqty.from/qty.to, fields that never existed on any variant).- Updated dependencies [
b1aa8db] - Updated dependencies [
3afd970] - Updated dependencies [
8f7e887] - Updated dependencies [
5194ba4] - Updated dependencies [
1d86e74] - Updated dependencies [
7b246ae] - Updated dependencies [
f147b25] - Updated dependencies [
9553678] - Updated dependencies [
68a2a45] - Updated dependencies [
7c83cf8] - Updated dependencies [
dcaadd7] - Updated dependencies [
0c2e818] - Updated dependencies [
943e9f8] - Updated dependencies [
24a108c] - Updated dependencies [
970c32b] - Updated dependencies [
23e4286] - Updated dependencies [
901e90e] - Updated dependencies [
064ba9f] - Updated dependencies [
b1aa8db] - Updated dependencies [
79d835c] - Updated dependencies [
d61d786]- @gram-lang/analyzer@1.0.0-beta.5
- @gram-lang/parser@1.0.0-beta.5
- @gram-lang/i18n@1.0.0-beta.5
- @gram-lang/kitchen@1.0.0-beta.5
1.0.0-beta.4
Major Changes
68365c4: Section retro-planning (e.g.## Section ~{-2h}) now enforces a strict signed-duration syntax instead of accepting arbitrary free text, preventing invalid timeline calculations. Added support for thed(day) time unit.
Patch Changes
7487b09: Fixed the display of alternative ingredient and cookware groups (@egg|@tofu). They now correctly render inline as a single joined line in shopping and section lists, rather than being dropped or rendered as oddly-wrapped sub-lists.0bee2b2: Added support for bare single-word children in composite ingredients (e.g.,@juice<@lemon), and allowed independent preparation instructions on the parent side. Fixed section ingredient lists silently dropping the parent reference.cb6b794: Fixed an issue where scaled fractions resulting in values below 1 (e.g.,0.5) were rendered as raw decimals instead of common fractions (e.g.,1/2) in the section ingredient list.fc47a86: Renamed thecookTimemetric toidleTimeacross the ecosystem to better reflect hands-off wait time. Additionally, passive timers sharing the same name are now automatically sequenced one after another on the same background track.b546f96: Fixed shopping list ingredient names defaulting to the database's canonical wording when the recipe used a valid alias. The lists now correctly preserve the recipe's original wording or translated alias, ensuring consistent language throughout.55430e4: Added detailed per-contribution time breakdowns (Active, Prep, Total) to compiled recipe metrics, and surfaced them as explanatory tooltips on the time summary badges in the HTML renderer.- Updated dependencies [
06039f2] - Updated dependencies [
7487b09] - Updated dependencies [
0bee2b2] - Updated dependencies [
e659677] - Updated dependencies [
aa0c082] - Updated dependencies [
fc47a86] - Updated dependencies [
68365c4] - Updated dependencies [
c1c9b53] - Updated dependencies [
68365c4] - Updated dependencies [
55430e4]- @gram-lang/kitchen@1.0.0-beta.4
- @gram-lang/parser@1.0.0-beta.4
- @gram-lang/i18n@1.0.0-beta.4
1.0.0-beta.3
Patch Changes
- Updated deployment configuration to automate npmjs packages publication
- Updated dependencies
- @gram-lang/i18n@1.0.0-beta.3
- @gram-lang/kitchen@1.0.0-beta.3
- @gram-lang/parser@1.0.0-beta.3
1.0.0-beta.2
Minor Changes
8fca04c:toHTMLno longer stamps footnote anchor ids withMath.random(). Output is now deterministic by default (ids likenote-1), which is required for byte-stable golden/conformance testing. If you render multiple recipes on the same page and relied on random ids to avoid anchor collisions, pass a newrenderIdoption (e.g. a recipe slug) to disambiguate.a46c24f: Upgraded all monorepo dependencies to their latest versions and implemented a TypeScript 7 dual setup for faster typechecking while preserving compilation toolchain compatibility. Fixed type errors arising from Node 26 and VS Code LSP v10 updates.
Patch Changes
-
0aec389: Fix_usageIdleaking a global counter across separatecompile()calls in the same process (affected the language server andgram scale's parallel compiles, making ids non-deterministic for an unchanged recipe). Fix nutrition analysis always reportingisEstimate: trueregardless of actual data precision. Fix the section mass badge in HTML output missing its scale icon. -
f5f1efe: chore: declaresideEffects: falseso bundlers can tree-shake unused exports from these packagesNo package previously declared this, so third-party bundlers had to assume every module might have side effects and couldn't safely drop unused code.
-
0ccfc99: Compiler warnings (CompilationResult.warnings,NutritionMetrics.warnings) are now always structuredWarningobjects ({ code, message, item?, loc?, section? }) instead of sometimes being plain strings depending on call order — a latent inconsistency that could previously produce"[object Object]"in some rendered output.Usage.composite,Usage.options, andProcessedStep.contentare now properly typed instead ofany. Also fixes range-based timer quantities (e.g.~{5-10min}) never displaying correctly ingram diffoutput, due to a pre-existing typo checking non-existent fields. -
Updated dependencies [
0aec389] -
Updated dependencies [
e192fe2] -
Updated dependencies [
404198a] -
Updated dependencies [
d837da3] -
Updated dependencies [
f5f1efe] -
Updated dependencies [
8dc9c60] -
Updated dependencies [
6eab9b3] -
Updated dependencies [
e55940f] -
Updated dependencies [
a46c24f] -
Updated dependencies [
0ccfc99]- @gram-lang/kitchen@1.0.0-beta.2
- @gram-lang/parser@1.0.0-beta.2
- @gram-lang/i18n@1.0.0-beta.2
1.0.0-beta.1
Major Changes
-
a1e6fe9: refactor: renameisAsynctoisPassiveto align with domain terminologyTo better align the codebase with the actual domain model of a kitchen, the "asynchronous" timer concept has been completely renamed to "passive". This introduces the following breaking changes for tool builders:
- AST: The
TimerASTnode propertyisAsync: booleanis nowisPassive: boolean. - CSS: The
.timer.asyncclass generated by the renderer has been renamed to.timer.passive. - Kitchen Metrics: All internal variables and comments referring to
asyncbackground tasks have been updated topassive.
- AST: The
Minor Changes
-
a244341: Major overhaul of the documentation and playground infrastructure:- Documentation Rewrite & i18n: The documentation has been completely rewritten, thoroughly verified, and is now fully translated into French (in addition to the English version).
- Advanced Vue 3 Playground: The legacy playground has been removed and rebuilt from the ground up using Vue 3. This new version is directly integrated into the documentation and introduces powerful new features, including recipe scaling and baker's math.
-
8921d9d: Fixed several correctness bugs found during a documentation audit, and added alias-aware cross-unit shopping list aggregation.- @gram-lang/analyzer:
unit_weight-based conversions (e.g.@avocado{1}) were being double-divided byyield— the whole-unit weight is now correctly treated as Gross Mass, with Net Mass derived forward (Gross × yield), while explicit mass/volume entries keep deriving Gross backward (Net ÷ yield) as before. Optional ingredients (?) are no longer counted in nutrition totals. NewresolveCanonicalId()resolves an ingredient name/alias to its database key, and a newaggregateShoppingList()step re-groups the shopping list by canonical id — merging aliased ingredients (e.g.beurre/butter) and cross-unit quantities (e.g.100g+1 cup) into a single gram total whenever every entry resolves to a mass, falling back to separate entries flaggedmultiUnit: truewhen a density is missing. - @gram-lang/renderer: The HTML shopping list now clusters consecutive
multiUnit-flagged entries for the same ingredient under one heading with a "⚠️ Mixed units" badge, instead of listing them as unrelated lines. - @gram-lang/cli:
shopper's alias resolution now reuses@gram-lang/analyzer'sresolveCanonicalId()instead of a separate, duplicated alias map.
- @gram-lang/analyzer:
-
fbe648e: Improve ingredient preparation tracking and display.- Kitchen:
aggregateSectionIngredientsnow groups ingredients by bothidandpreparation, creating separate entries for the same ingredient if it requires different preparations (e.g. cold vs melted). - Renderer: A new
formatModeoption in the render context controls preparation rendering. Preparations remain visible in inline text to prevent information loss. In the section's ingredient list (Mise-en-place), they are cleanly displayed with an em-dash. In the global shopping list, they remain hidden.
- Kitchen:
-
2476140: Added a centralizedScaleEnginein@gram-lang/kitchento make recipe scaling (--scale) and Baker's Percentage math safer and more consistent everywhere.- @gram-lang/kitchen: New
resolveScaleFactor()/applyScale()API validates a--scaletarget before computing a factor — rejecting fixed (@=) ingredients, relative quantities, ingredients only used inside a sub-recipe, ingredients inside an alternative-ingredient group, and ingredients split across incompatible units, with a clear error instead of a silently wrong number. A sub-recipe's own total (e.g. "2 lemons") is itself a valid scale target. Scaling is now a pure operation (never mutates the original recipe), and the compiled recipe now carries an explicitscaleFactorfield. Covered by a new unit test suite. - @gram-lang/analyzer: Fixed the
@*Baker's-reference auto-detection (it silently never matched before), and it now refuses to use a relative-quantity ingredient as the 100% base instead of computing bogus percentages. The enriched JSON AST now natively includes abakersPercentagefield for all ingredients if a reference ingredient is declared or passed via thebakersReferenceoption.convertUnit()now accepts an optional density (g/mL) to bridge mass ↔ volume conversions; newresolveIngredientDensity()andparseDensityOverrides()helpers resolve that density from a recipe'sdensities:frontmatter. Also includes a critical null-safety fix when parsing recipes containing standalone comments. - @gram-lang/renderer: Natively supports formatting Baker's Percentages provided by the analyzer (for HTML and Markdown exports, and the Playground), removing its legacy calculation logic. Fixed
gram print --bakers-math-onlyhaving no effect. - @gram-lang/cli: The CLI now cleanly acts as a presentation layer for Baker's Math, reading percentages directly from the AST. Added
--bakers-math,--bakers-reference, and--bakers-math-onlyflags to theview,printandexportcommands.--scale id=valuenow supports same-family unit conversion and cross-family conversion when a density is available; suggests the closest matching ingredient name on a typo; no longer shows corrupted comparison rows for an ingredient split across multiple units ingram scale.
- @gram-lang/kitchen: New
Patch Changes
-
e6cf842: Refined formatting and mass normalization for relative quantities:- Cleaner Display: Relative quantities are now seamlessly displayed without internal
@or&markers (e.g.,125% of lemon juice). The redundant formula brackets[125% of...]have been removed from inline instructions. - Robust Shopping List Aggregation: The compiler (
@gram-lang/kitchen) now strictly tracks ingredient lineage using_usageIds. This allows the analyzer (@gram-lang/analyzer) to flawlessly compute exact masses for complex items in the shopping list without confusing standard ingredients and their alternatives. - Shopping List Accuracy: When mass normalization is enabled, the shopping list will now accurately display the fully resolved physical mass for relative quantities (e.g.,
sugar (156 g)) instead of falling back to the formula string.
- Cleaner Display: Relative quantities are now seamlessly displayed without internal
-
Updated dependencies [
a244341] -
Updated dependencies [
1eafa64] -
Updated dependencies [
a1e6fe9] -
Updated dependencies [
fbe648e] -
Updated dependencies [
6013e64] -
Updated dependencies [
e6cf842] -
Updated dependencies [
2476140] -
Updated dependencies [
3f7bc5d] -
Updated dependencies [
979f32b]- @gram-lang/kitchen@1.0.0-beta.1
- @gram-lang/parser@1.0.0-beta.1
1.0.0-beta.0
Major Changes
-
2dcd766: Introduction of the official GRAM CLI (@gram-lang/cli), a comprehensive command-line tool to manage, compile, and interact with your recipes.Project & Recipe Management:
- Project Setup:
gram initsafely scaffolds a.gramenvironment, including interactive AI provider setup (Google, OpenAI, Anthropic, Ollama) and secret management. - Automated Import:
gram importscrapes recipes from any URL and uses AI to flawlessly translate and convert them into native.gramsyntax. - Validation & Compilation:
gram checkinstantly validates syntax and database integrity.gram buildcompiles recipes to robust JSON with full physical and nutritional enrichment. - Smart Scaling & Diff:
gram scaledynamically resizes recipes (e.g.,--scale flour=300g) with a visual before/after comparison.gram diffprovides a semantic "git diff" for cooking, tracking changes in quantities, timings, and steps. - Export & Print:
gram printgenerates a beautifully typeset A4 HTML recipe card.gram exportconverts recipes to clean Markdown or static HTML. - Auto-formatting & Watcher:
gram formatautomatically enforces.gramlanguage styling standards.gram watchprovides real-time validation upon saving.
Interactive Cooking & Daily Use:
- Terminal Cooking Assistant (
gram cook): A step-by-step interactive TUI (Terminal User Interface) that guides you through the recipe, featuring a dynamic ingredient checklist and live background timers. - Smart Shopping List (
gram shop): Aggregates ingredients across multiple recipes, automatically converting volumes to masses and sorting them by supermarket aisle. - Recipe Search (
gram suggest): An alias-aware search engine to find recipes based on your available ingredients (e.g.,--with "butter, eggs" --without "milk"). - Rich Terminal Preview (
gram view): Renders recipes directly in the terminal with color coding, active timers, and nutritional tables.
AI-Powered Database Management (
gram db):- Smart Database Sync & Enrichment:
gram db syncautomatically tracks new ingredients across your project.gram db enrichuses AI to automatically fill in missing densities, unit weights, categories, and nutrition facts. - Semantic Linting & Conflict Resolution:
gram db lintuses AI to detect plural mistakes and semantic duplicates (e.g.,scallionvsgreen onion).gram db mergehandles conflicts when integrating external community databases.
- Project Setup:
Minor Changes
-
79105ce: Complete overhaul of the VS Code Extension with Language Server, Live Preview, and advanced assistanceMajor New Features:
- Full Language Server (LSP): The extension now ships with a complete language server. All advanced features activate instantly upon opening a
.gramfile. - Dynamic Live Preview: A side-by-side WebView panel displaying the real-time HTML render of the recipe as you type.
- Gracefully handles syntax errors via a visual fallback.
- Integrates the official Playground styles for perfect consistency.
- CodeLens & Inlay Hints:
- Inlay Hints: Displays the cumulative total time in gray next to section titles.
- CodeLens: Clickable buttons
▶ Previewand📊 Macrosabove the main recipe title for quick access.
Ingredient Database & Nutrition:
- Automatic Loading: Automatically detects and loads
.gram/ingredients.yamlfrom the workspace root (or via the path configured ingram.ingredientDatabase.pathsettings). Optimized indexing (O(1)) for maximum performance. - Seamless Plural Management: The extension silently handles plurals (e.g.,
@carrots{3}will automatically matchcarrot). No error diagnostics are raised, everything is transparent. - Nutritional Hover & Macros Panel:
- Hovering over an ingredient displays a complete nutritional table (calories, proteins, carbs, fats, etc.).
- The Live Preview integrates a Macros panel (hidden by default) that can be shown via CodeLens, featuring clear visual alerts for ingredients missing data.
- Fuzzy Matching "Did you mean?": Levenshtein algorithm (distance ≤ 2) suggests corrections if an ingredient is misspelled (e.g.,
@tomaatosuggests@tomato). Directly integrated into Quick Fix code actions. - On-Hover Unit Conversion: Automatically converts volumes (ml, tbsp, etc.) to grams when hovering over an ingredient if its density is known in the database.
Editing Assistance & Navigation:
- Advanced Contextual Autocompletion:
- After
@: Suggests ingredients and their aliases from the YAML database. Automatically adds curly braces{}for multi-word names. - After
&: Suggests only the existing intermediate declarations in the document. - Inside
{}: Suggests canonical units (mass, volume, time) and their aliases (French/English) as soon as a digit is typed.
- After
- Smart Navigation:
- Go to Definition (
Ctrl+Click/F12) on a&refreference to jump to its->&refdeclaration. - Find All References (
Shift+F12) to list all usages of an intermediate. - Rename Symbol (
F2) to atomically rename an intermediate (declaration + references). - Outline Panel showing the hierarchy of sections and elements, with foldable code in the gutter.
- Go to Definition (
- Intermediate Hover: Displays the full text of the step where the intermediate was created.
Diagnostics & Code Actions (Quick Fixes):
- Real-Time Diagnostics:
- Red underline for an orphaned
&refreference. - Warning for an unused
->&refdeclaration. - Warning if the frontmatter (title) is missing.
- Red underline for an orphaned
- Code Actions (💡):
- Quick Fix: Insert the missing
title:in the frontmatter. - Quick Fix: Remove an unused intermediate declaration.
- Quick Fix: Declare a missing intermediate for an existing reference.
- Refactor: Convert a volume quantity to mass directly in the code.
- Refactor: Replace a misspelled ingredient with the closest Fuzzy match suggestion.
- Quick Fix: Insert the missing
Semantic Highlighting, Formatting & Snippets:
- Semantic Tokens: Regex-based syntax highlighting (TextMate) is replaced by AST-driven highlighting. Offers surgical precision for ingredients, timers, temperatures, comments, and nested units (e.g., precise separation of value and unit in
{10g}). - Auto-formatting (
Alt+Shift+F):- Normalization of spaces inside curly braces (
{ 200 g }→{200g}). - Normalization of composite ingredients (
@a < @b→@a<@b). - Alignment of section titles and tab-to-space conversions.
- Normalization of spaces inside curly braces (
- Built-in Snippets: Keyboard shortcuts for the basic structure (frontmatter, sections, steps), ingredient variants (
@ing,@?,@-), cookware (#cw), and timers/temperatures.
- Full Language Server (LSP): The extension now ships with a complete language server. All advanced features activate instantly upon opening a
-
babbb20: Core language update to enforce new syntax adjustments (breaking changes).- Grammar & Parsing:
- Made
{}optional for single-word ingredients. - Replaced temperature symbol with
°. - Replaced async timers with
~&{}. - Replaced aliases brackets with
:. - Tightened
<@with no spaces allowed. - Added fixed modifier
=. - Mandatory
@&inside relative quantities declarations. (e.g:@water{60% @&flour}) - Top-Level Support: Allowed writing comments and recipe steps globally, anywhere in the document (even before the first
## Section).
- Made
- Compiler Analysis:
- Added
INVALID_MODIFIER_COMBINATIONwarnings. - Updated AST transformations to support the new modifiers parsing rules and the implicit top-level sections grouping.
- Added
- Grammar & Parsing:
-
babbb20: Aligned visual tooling and test recipes with the new grammar.GramHighlight.ts(Playground & VSCode): Updated all syntax highlighting regular expressions to accurately match the new syntax (new temperature symbols, updated modifiers, etc.).- Examples (
basquaise_chicken.gram,lemon_meringue_pie.gram,torture.gram): Fully migrated recipe code to comply with the new grammar.
-
caf1630: Major architecture refactoring, ESM Migration, performance optimizations and code cleanup -
babbb20: Complete overhaul of the documentation to reflect the new syntax changes.
Patch Changes
b2a235c: NutritionMetrics output field renamed fromsalttosodiumto match the ingredient database schema- Updated dependencies [
6e95e35] - Updated dependencies [
79105ce] - Updated dependencies [
babbb20] - Updated dependencies [
babbb20] - Updated dependencies [
caf1630] - Updated dependencies [
babbb20] - Updated dependencies [
2dcd766]- @gram-lang/kitchen@1.0.0-beta.0
- @gram-lang/parser@1.0.0-beta.0
0.10.1
Patch Changes
- Cleaned up and updated dependencies.
- Implemented Turborepo to optimize and simplify project building.
0.10.0
Minor Changes
d89c2a4: Created a new shared @gram-lang/renderer package to handle HTML and Markdown generation.