from Hacker News

Cooklang – Recipe Markup Language

by SethKinast on 6/27/23, 11:32 PM with 108 comments

  • by duped on 6/28/23, 1:03 AM

    > Slowly add @milk{4%cup} [- TODO change units to litres -], keep mixing

    No! Handle units! @milk{4%cup} should be trivially convertible to liters and configured by the user. For harder conversions (volume to mass) keeping a list of ingredients and their densities (configurable of course) would be extremely useful.

    On that subject, being able to specify a recipe in terms of ratios and then automatically convert it to scale would be a super power that I can't beat by hand.

    For example when I bake I do everything by weight and have all the recipes I like written out by hand with unit conversions. Because measuring by volume isn't easier in 2023 than placing your mixing bowl on a kitchen scale and balancing everything to the mass of your butter and eggs.

  • by rpearl on 6/28/23, 12:28 AM

    Pretty much every recipe written since literally the 1890s / Fannie Farmer already has pulled out ingredients and quantities into their own separate section from steps.

    To use cooklang, it appears that I have to rewrite recipes to include ingredients inline. No other recipes tend to use this style, because it is harder to read.

    If I write recipes in cooklang, the plain text of the recipes is harder to understand without tools that speak cooklang, forcing me to use the tools to get an understandable format. The output of the CLI tool seems like a better format than the format itself!

  • by Kalabasa on 6/28/23, 2:34 AM

    I like how it escalates as I scroll further. It has a website, cool. Then it has an app?!

    Then finally you reach the footer and click on https://github.com/cooklang, then you see it has a bunch of cooklang libraries, e.g., TypeScript, python, C, etc.!

    It even has a VSCode syntax highlighting package!

    I appreciate the comprehensiveness of the project. It’s more than a markup language, cooklang seems to be an entire ecosystem.

  • by scrps on 6/28/23, 3:42 AM

    A feature I think would be helpful would be a reverse shopping list (for lack of a better term) where you can say 'I have ingredients a, b, c... list what recipes do I have all or ≥ n% the ingredients for?'

    I shall poke around the cli code.

  • by NoMoreNicksLeft on 6/28/23, 5:50 AM

    This seems primitive. I see there is some understanding that there needs to be "cookware" elements, but how am I supposed to indicate it requires a brick pizza oven or a tandori oven? These aren't trivial cookware. I'd want some way to filter these out without having to go through and indicate the 500 large appliances I don't have before I can see which recipes are feasible.

    I could add metadata tags that would indicate just what the dish was (entree, or a fancy breakfast/brunch, or a desert, etc), but since there's nothing like a standard tag if anyone else gets the file those tags are mostly worthless (their software won't be able to sort a bunch of recipes into the correct categories).

    There's no way to indicate how many times the recipe has been verified (apparently the vast majority of online recipes are made-up bullshit that even the author hasn't bothered to cook even once).

    Even pictures... I might want more than one non-step picture for the recipe.

    Naming convention is whacked out. This works for 5 recipe files in a folder. What happens when I have 80,000? Or 2.1 million? r/datahoarder would be disappointed. How many different pot roast recipes is that? Is it only eight dozen, or is it more like 900? Are they all just numbered, 1 through n?

    Hell, there are some classic recipes that are seasonal. They want not just "chicken eggs" but "spring chicken eggs" as opposed to summer or fall. How do I filter those out so I don't see them in November?

  • by mcdonje on 6/28/23, 1:35 AM

    Putting ingredients inline is interesting. I think I actually see the sense in it. As a reader, I want the ingredients list at the top, but as a writer, I'll think about ingredients as I write the instructions. So, doing it this way potentially saves on jumping back and forth between the instructions and the list, which almost feels like boilerplate.

    However, if you want to make shopping list annotations, then you're doing that extra work anyway. In a separate file? It'd be cool if the spec allowed for doing an ingredients list with annotations at the top of the recipe if the writer so chooses. The current syntax works, but not for all people/scenarios.

    How would I do recipes with sections? For instance: https://www.kingarthurbaking.com/recipes/fast-summer-berry-p...

    Note the ingredient sections; crust, filling, topping. Note the step numbers. Note the link to another recipe. Note the step section titles that are represented here in bold and which don't perfectly match with the ingredient sections. Note the footnotes at the end.

    Not sure how I'd do most of those things with this markdown spec.

  • by soperj on 6/28/23, 4:48 AM

    I actually made a webapp[0] that does a lot of this, but the it's markdown instead of it's own markup language. Benefit of it being online instead of having to run a local server is that you can use other people's recipes (or fork them if you want to alter them). There's also a drag and drop interface for weekly meal planning that makes your grocery list for you instead of having to write them out.

    [0] - www.reciped.io

  • by Niksko on 6/28/23, 4:30 AM

    I would use this if: * it supported units and conversions * I'm now one of those annoying obsidian people, so it needs an obsidian plugin.

    EDIT: It has an obsidian plugin, though the last release was 2 years ago: https://github.com/deathau/cooklang-obsidian

  • by 22c on 6/28/23, 12:33 AM

    This is interesting though perhaps a bit over-engineered.

    I'd probably find myself less motivated to simply type something out to recipe.txt vs. manage all this but CookCLI does open up some interesting possibilities.

    The first thing that came to mind would be that it'd be cool if CookCLI could "halve" recipes automatically. Say you had a recipe for 12 muffins but you only wanted to make 6 or 4, it could automatically divide those quantities and spit out a new recipe or shopping list.

    Another cool CLI feature would be unit conversion; converting things like fluid ounces, or cups into ml.

    My other piece of feedback is the overloading of {} for ending multi-word ingredient seems a bit off. It's more syntax but I'd still rather have something dedicated for that purpose eg. @(ground black pepper)

  • by jkellermann on 6/28/23, 2:37 PM

    Sounds interesting!

    Some years ago, I came across a recepie as flowchart graph. This idea appealed to me instantaneously, because a picture to me is a thousand times better than a lettersoup. Especially when I'm not constantly reading the text, but have to check the pots and pans regularly.

    I think this markup language could be used as input for an engine that generates nice recepie graphs.

    And then an integration into the tandori.dev application?

  • by brisketbbq on 6/28/23, 6:04 PM

    Just about three weeks ago, I made a fossil repo to keep track of my recipies.

    I write them in markdown and use fossil's webserver to be able to access them while in the kitchen. If I need to see ingridents while i'm out, i activate my tailscale VPN on my phone and browse to the fossil webserver.

    Thankfully i'm not the only one who has oven-engineered a simple solution.

  • by yonrg on 6/29/23, 8:34 AM

    I started to note down recipes as sequence diagrams. This gives me clear insight about duration (incl preparation and waiting times, etc), order of steps and parallelization of steps.

    I wrote them with pen and paper. Recently I experimented with the mermaid extension for markdown. It has its drawbacks but works.

  • by armanboyaci on 6/28/23, 2:52 AM

    Reminded me this blog post about the complexity cost of trying to cover all the edge cases, using the example of recipe writing!

    https://buttondown.email/hillelwayne/archive/edge-case-poiso...

  • by fn-mote on 6/28/23, 1:33 AM

    Jumping ahead, I want a plugin that automatically applies "standard" volume to mass conversions for me. E.g. 1 C whole wheat flour is 5.5 oz (or 150 g).

    This is walking the line of laziness (why don't I just look them up myself), but it sounds great.

    Maybe I can combine the web server with a customized GNU units.

    I don't love the % either.

    Fun stuff, nice creation!

  • by macocha on 6/28/23, 11:55 AM

    On topic of different representations of cooking recipes I really dig a way the recipe cards are done here: https://www.cookingforengineers.com.

    There's something quite simple and elegant about them.

  • by dang on 6/28/23, 11:39 AM

    Related:

    Show HN: CookLang – Recipe Markup Language - https://news.ycombinator.com/item?id=28997309 - Oct 2021 (146 comments)

  • by lucasban on 6/28/23, 4:00 AM

    It would be cool if someone could make a web recipe parser (similar to how Paprika works) that could export in this format, or at least convert another recipe file format to this one.
  • by stevage on 6/28/23, 1:11 AM

    Some of the syntax seems...suboptimal.

    For instance, why is the % required? There aren't that many units; surely {0.5 kg} can automatically be parsed, rather than requiring {0.5%kg}.

  • by brisketbbq on 6/28/23, 6:07 PM

    Is there a way to see recipes based on the cooking method?

    Show me all the recipes that use the oven, sous vide, grill, smoker, etc.