How to Add a New Recipe Using the Template in HowToCook
To add a new recipe using the template in the HowToCook repository, copy dishes/template/示例菜/示例菜.md to your target directory, rename it to match your dish name exactly, remove all HTML comment blocks, and fill in each required section following the established formatting rules.
The HowToCook repository by Anduin2017 stores recipes as Markdown files under the dishes/ directory. To maintain consistency across hundreds of recipes, the project provides a standardized template that defines the required structure, naming conventions, and formatting rules for every new submission.
Locating the Official Recipe Template
The canonical template resides at dishes/template/示例菜/示例菜.md. This file serves as the source of truth for all required sections and formatting standards. The repository's README.md and CONTRIBUTING.md files explicitly direct contributors to copy and modify this template before creating any new recipe, ensuring that every submission adheres to the project's architectural standards.
Step-by-Step Process to Add a New Recipe Using the Template
1. Copy the Template to the Correct Directory
Duplicate the template file and place it in the appropriate subdirectory under dishes/. For example, to create a beef recipe, you would execute:
# Copy the template
cp dishes/template/示例菜/示例菜.md dishes/meat_dish/红烧牛肉/红烧牛肉.md
# Navigate to the new directory
cd dishes/meat_dish/红烧牛肉
2. Rename the File to Match the Dish Name
The filename must match the dish name exactly. The top-level heading inside the file must follow the format "<菜名>的做法" (e.g., # 红烧牛肉的做法).
3. Remove HTML Comment Blocks
The template contains HTML comments (<!-- … -->) that provide guidance to contributors. You must strip all comment blocks before submitting your pull request, as these are instructional metadata and should not appear in the final recipe.
4. Fill in the Required Sections
Replace the placeholder content with your recipe details, maintaining strict adherence to formatting rules such as using a single space between Chinese characters and numbers, and inserting a blank line between the title and body.
5. Add a Finished Dish Image
Place a photo of the completed dish in the same directory as the markdown file. Reference it using the standard image syntax:

6. Update the Difficulty Rating
Modify the "预估烹饪难度" line to reflect the actual difficulty of your dish using the star rating system (★).
Required Recipe Sections Explained
简介 (Introduction)
Provide a short description of the dish, nutritional highlights, serving size (e.g., "适合 2-3 人食用"), and estimated total time.
预估烹饪难度 (Estimated Cooking Difficulty)
Assign a difficulty rating using stars (★), ranging from one star (simple) to five stars (complex).
必备原料和工具 (Required Ingredients and Tools)
List every required ingredient and kitchen tool. Avoid duplicating items that appear in the "厨房采购" section.
计算 (Calculation)
Specify per-serving quantities and provide scaling formulas so readers can adjust portions mathematically.
操作 (Operations)
Provide a step-by-step, time-precise procedure. Include specific timing instructions such as "等待 10 秒让油温升高" or "搅拌 10 分钟".
附加内容 (Additional Content)
Include optional tips, safety warnings, troubleshooting advice, and reference links to external videos or documentation.
Key Files and Their Roles
| File | Role |
|---|---|
dishes/template/示例菜/示例菜.md |
Official recipe template defining all required sections and formatting rules |
README.md |
General contribution guide directing users to the template |
CONTRIBUTING.md |
Detailed contributor instructions emphasizing template usage |
.github/templates/readme_template.md |
Template for auto-generated PR descriptions |
Summary
- Copy
dishes/template/示例菜/示例菜.mdto the appropriatedishes/subdirectory when adding a new recipe. - Rename the file to match the dish name exactly and format the H1 heading as "
<菜名>的做法". - Remove all HTML comment blocks from the template before submission.
- Fill in all six required sections: 简介, 预估烹饪难度, 必备原料和工具, 计算, 操作, and 附加内容.
- Include a finished dish image in the same folder and reference it with standard markdown image syntax.
Frequently Asked Questions
Where is the recipe template located in the HowToCook repository?
The recipe template is located at dishes/template/示例菜/示例菜.md. This file contains the canonical structure that all recipes must follow, including the required sections and formatting guidelines.
What naming convention should I follow when adding a new recipe?
The filename must match the dish name exactly, and the top-level markdown heading must be formatted as "<菜名>的做法". For example, a recipe for 红烧牛肉 should be saved as dishes/meat_dish/红烧牛肉/红烧牛肉.md with the heading # 红烧牛肉的做法.
Do I need to remove the HTML comments from the template?
Yes, you must strip all HTML comment blocks (<!-- … -->) from the template before submitting your pull request. These comments serve as instructional guidance for contributors but should not appear in the final recipe file.
How do I calculate the ingredient quantities for different serving sizes?
Use the "计算" section to specify per-serving quantities and provide scaling formulas. For example, if a recipe serves 2 people and requires 500g of meat, specify "每份(2人):牛腩 250g" so readers can mathematically scale the ingredients up or down based on their needs.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →