Cooklang完全指南:革命性食谱标记语言如何改变你的烹饪体验
Cooklang是一种革命性的食谱标记语言,它以纯文本格式为基础,通过简洁的标记语法为烹饪爱好者和专业厨师提供了一种既易于阅读又能被机器解析的食谱编写方式。作为开源烹饪生态系统的核心,Cooklang让食谱管理、分享和自动化变得前所未有的简单。
什么是Cooklang?为什么它如此特别? 🤔
Cooklang不仅仅是一种文本格式,它是一个完整的开源生态系统的核心。这种标记语言允许你在普通英文指令中嵌入机器可识别的标记,轻松记录食材、厨具、时间和元数据等关键信息。
想象一下,你可以:
- 用纯文本编写食谱,却能让应用自动识别食材和用量
- 一键生成购物清单,无需手动计算和转换单位
- 轻松调整食谱份量,所有食材用量自动按比例缩放
- 在不同设备和应用间无缝同步和分享你的食谱收藏
Cooklang的魔力在于它的简洁性和强大功能的完美结合。每个.cook文件都是一个独立的食谱,既可以用普通文本编辑器打开,也能被专业烹饪应用解析和处理。
快速入门:Cooklang基础语法 🚀
食材标记:让每一种原料都被精确识别
在Cooklang中,食材用@符号标记。对于单字食材,直接使用@+食材名称:
Then add @salt and @pepper to taste.
对于多字食材,使用{}来明确标记食材名称的结束:
Add @ground black pepper{} to the sauce.
要指定数量和单位,在食材名称后的{}中使用%分隔数量和单位:
Place @bacon strips{1%kg} on a baking sheet and glaze with @syrup{1/2%tbsp}.
步骤编写:简单直观的烹饪流程
Cooklang中,每个段落就是一个烹饪步骤,段落之间用空行分隔:
A step,
the same step.
A different step.
如果需要在步骤内强制换行,只需在行尾添加反斜杠\:
Lay out the @rice paper{1}.\
Top with @avocado{1/2}(sliced),\
@cucumber{1/2}(julienned),\
and @cooked shrimp{4}.
厨具标记:记录你需要的每一件工具
用#符号标记所需厨具,语法与食材类似:
Place the potatoes into a #pot.
Mash the potatoes with a #potato masher{}.
时间控制:精确设定烹饪时长
使用~符号定义计时器,可选择添加名称以便应用程序在通知中使用:
Lay the potatoes on a #baking sheet{} and place into the #oven{}. Bake for ~{25%minutes}.
Boil @eggs{2} for ~eggs{3%minutes}.
进阶功能:让你的食谱更专业 🌟
元数据:为食谱添加丰富背景信息
通过YAML前置 matter 为食谱添加标题、标签、准备时间等元数据:
---
title: Spaghetti Carbonara
tags:
- pasta
- quick
- comfort food
prep_time: 10%minutes
cook_time: 15%minutes
---
注释:记录你的烹饪心得
使用--添加行内注释,或用[- -]添加块注释:
-- Don't burn the roux!
Mash @potato{2%kg} until smooth -- alternatively, boil 'em first, then mash 'em, then stick 'em in a stew.
Slowly add @milk{4%cup} [- TODO change units to litres -], keep mixing
笔记:添加烹饪背景和故事
用>开头添加笔记,记录与烹饪步骤相关但不属于指令的背景信息:
> This recipe has been in our family for three generations. My grandmother originally used lard instead of butter, but we've adapted it for modern tastes.
Melt @butter{2%tbsp} in a #saucepan{} over medium heat.
章节:组织复杂食谱的完美方式
对于包含多个组件的复杂食谱,使用章节功能进行组织:
= Dough
Mix @flour{200%g} and @water{100%ml} together until smooth.
== Filling ==
Combine @cheese{100%g} and @spinach{50%g}, then season to taste.
食材预处理简写:简化重复操作
直接在食材标记中添加预处理说明,避免重复描述:
Mix @onion{1}(peeled and finely chopped) and @garlic{2%cloves}(peeled and minced) into paste.
实战示例:Easy Pancakes.cook 解析 🍳
让我们通过一个实际的.cook文件来看看Cooklang的强大功能:
-- TODO add source
Crack the @eggs{3} into a blender, then add the @flour{125%g}, @milk{250%ml} and @sea salt{1%pinch}, and blitz until smooth.
Pour into a #bowl and leave to stand for ~{15%minutes}.
Melt the butter (or a drizzle of @oil if you want to be a bit healthier) in a #large non-stick frying pan{} on a medium heat, then tilt the pan so the butter coats the surface.
Pour in 1 ladle of batter and tilt again, so that the batter spreads all over the base, then cook for 1 to 2 minutes, or until it starts to come away from the sides.
Once golden underneath, flip the pancake over and cook for 1 further minute, or until cooked through.
Serve straightaway with your favourite topping.
这个简单的 pancakes 食谱包含了:
- 4种精确计量的食材
- 2种厨具(碗和不粘锅)
- 1个15分钟的静置时间
- 清晰的分步说明
- 烹饪技巧注释
Cooklang应用可以轻松解析这个文件,提取食材清单、生成购物列表、甚至根据食用人数自动调整食材用量。
Cooklang生态系统:探索更多可能 🌐
Cooklang不仅仅是一种标记语言,它拥有一个不断成长的生态系统:
- Cooklang Playground:在线试用Cooklang语法的交互式环境
- Obsidian插件:将Cooklang集成到你的笔记系统中
- CookCLI:官方命令行工具,用于处理和转换
.cook文件 - 移动应用:官方iOS和Android应用,让你在厨房中轻松使用Cooklang食谱
- 语法高亮:支持多种编辑器,包括VSCode、Vim、Emacs等
开始使用Cooklang的简单步骤 📝
- 安装语法高亮插件:为你的代码编辑器安装Cooklang语法高亮插件,如VSCode的CookVSCode
- 创建第一个食谱:新建一个
.cook文件,使用上述语法编写你的第一个食谱 - 尝试CookCLI:安装官方命令行工具,体验食材提取、购物清单生成等功能
- 探索社区项目:查看社区开发的应用和插件,扩展你的Cooklang体验
要开始使用Cooklang,你可以克隆官方仓库:
git clone https://gitcode.com/gh_mirrors/spec7/spec
结语:Cooklang如何改变你的烹饪体验
Cooklang将烹饪的艺术性与技术的精确性完美结合。它不仅让你能够以人类可读的方式记录食谱,还能让计算机理解和处理这些信息,为你提供从购物到烹饪的全方位支持。
无论你是家庭烹饪爱好者、专业厨师,还是喜欢尝试新食谱的美食探索者,Cooklang都能简化你的烹饪流程,让你更专注于创造美味,而不是记录和管理食谱。
现在就开始用Cooklang编写你的第一个食谱吧!你的厨房体验将从此焕然一新。
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考



