Skip to content

Commit

Permalink
Merge pull request #32 from briansunter/recipes
Browse files Browse the repository at this point in the history
Recipes
  • Loading branch information
briansunter authored Mar 30, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 4b12303 + d61f03d commit d529d9f
Showing 62 changed files with 1,379 additions and 2 deletions.
3 changes: 2 additions & 1 deletion site/astro.config.ts
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ import remarkWikiLinkPlugin from "remark-wiki-link";
import icon from "astro-icon";
import rehypeFigure from "@microflash/rehype-figure";
import remarkGfm from "remark-gfm-no-autolink";
import cooklang from './cooklang-astro';

// https://astro.build/config
export default defineConfig({
@@ -28,7 +29,7 @@ export default defineConfig({
// experimental: {
// contentCollectionCache: true,
// },
integrations: [mdx(), sitemap(), tailwind(), icon()],
integrations: [mdx(), sitemap(), tailwind(), icon(), cooklang()],
prefetch: {
prefetchAll: true,
},
112 changes: 112 additions & 0 deletions site/cooklang-astro.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import { Recipe } from "@cooklang/cooklang-ts";
import z from "zod";
import type { AstroIntegration, DataEntryType, HookParameters } from "astro";

const shoppingItemSchema = z.object({
name: z.string(),
synonym: z.string().optional(),
});

const ingredientSchema = z.object({
type: z.literal("ingredient"),
name: z.string(),
quantity: z.number(),
units: z.string(),
});

const cookwareSchema = z.object({
type: z.literal("cookware"),
name: z.string(),
quantity: z.number(),
});

const timerSchema = z.object({
type: z.literal("timer"),
quantity: z.number(),
units: z.string(),
});

const stepItemSchema = z.union([
z.object({
type: z.literal("text"),
value: z.string(),
}),
ingredientSchema,
cookwareSchema,
timerSchema,
]);

export const recipeSchema = {
slug: z.string().optional(),
ingredients: z.array(ingredientSchema).default([]),
cookwares: z.array(cookwareSchema).default([]),
metadata: z.any().optional(),
steps: z.array(z.array(stepItemSchema)).default([]),
shoppingList: z.record(shoppingItemSchema).optional(),
};

type SetupHookParams = HookParameters<"astro:config:setup"> & {
addPageExtension: (extension: string) => void;
addDataEntryType: (dataEntryType: DataEntryType) => void;
};

type EntryInfoInput = {
fileUrl: URL;
contents: string;
};

type EntryInfoOutput = {
data: Record<string, unknown>;
rawData: string;
body: string;
slug: string;
};

function getEntryInfo({ fileUrl, contents }: EntryInfoInput): EntryInfoOutput {
const recipe = new Recipe(contents, {
defaultCookwareAmount: 1,
defaultIngredientAmount: 1,
});

const { ingredients, cookwares, metadata, steps, shoppingList } = recipe;

let slug = metadata.slug;

if (!slug) {
slug = (fileUrl.pathname.split("/").pop() || "")
.toLowerCase()
.split(" ")
.join("-");
}
const data = {
...metadata,
slug,
cookwares,
ingredients,
metadata,
shoppingList,
steps,
};
return {
slug,
data,
body: contents,
rawData: contents,
};
}

export default function cooklangIntegration(): AstroIntegration {
return {
name: "@astrojs/cooklang",
hooks: {
"astro:config:setup": async (params) => {
const { addDataEntryType } = params as SetupHookParams;

addDataEntryType({
extensions: [".cook"],
getEntryInfo,
});
},
},
};
}
6 changes: 6 additions & 0 deletions site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions site/package.json
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
"@astrojs/mdx": "^2.1.1",
"@astrojs/rss": "^4.0.5",
"@astrojs/tailwind": "^5.1.0",
"@cooklang/cooklang-ts": "^1.2.6",
"@iconify-json/bi": "^1.1.23",
"@iconify-json/logos": "^1.1.42",
"@iconify-json/mdi": "^1.1.64",
3 changes: 3 additions & 0 deletions site/src/components/Header.astro
Original file line number Diff line number Diff line change
@@ -25,6 +25,9 @@ import { SITE_TITLE, NEWSLETTER_LINK } from "../consts";
<li>
<a class="block px-4 py-2 text-lg hover:bg-gray-200 rounded-lg transition-colors duration-200" href="/pages">All Pages</a>
</li>
<li>
<a class="block px-4 py-2 text-lg hover:bg-gray-200 rounded-lg transition-colors duration-200" href="/recipes">Recipes</a>
</li>
<li>
<a class="block px-4 py-2 text-lg hover:bg-gray-200 rounded-lg transition-colors duration-200" href={NEWSLETTER_LINK}>Newsletter</a>
</li>
10 changes: 9 additions & 1 deletion site/src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineCollection, z } from 'astro:content';
import {recipeSchema} from '../../cooklang-astro';
const blog = defineCollection({
type: 'content',
schema: z.object({
@@ -47,5 +48,12 @@ const photos = defineCollection({
}),
});

export const collections = { logseq, blog, photos};
const recipes = defineCollection({
type: "data",
schema: z.object({
...recipeSchema
})
});

export const collections = { logseq, blog, photos, recipes};

32 changes: 32 additions & 0 deletions site/src/content/recipes/aeropress-coffee.cook
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
>> title: Aeropress Coffee
>> description: Using an Aeropress is the fastest simplest way to brew a single cup of great coffee.
>> source: https://bluebottlecoffee.com/brew-guides/aeropress
>> tags: drink, coffee
>> prep time: test
>> cook time: test
>> servings: 1 serving
>> image: test.jpg

Bring @water{200%g} (7 oz) to a boil then let cool. Water should be around 200 F.

Weigh out @coffee{18%g} and grind to a texture slightly finer than sea salt using a #coffee grinder{} .

Insert a @aeropress metal filter{} , with an optional extra @aeropress paper filter{} into the AeroPress's detachable plastic cap.

Use some of your hot water to wet your filter and cap, so the filter adheres to the cap and heats your brewing vessel. Hold the cap by the edges and pour the water very slowly so it can be absorbed by the filter.

Place aeropress on your #digital scale{} with the flared end up, then tare the weight. The numbers on the side of the aeropress should appear upside-down.

Add your ground coffee. Be careful not to spill any grounds into the ring-shaped gutter at the top of the AeroPress.

Start a #timer{} . Add twice the weight of water than you have grounds (e.g., for 18 grams coffee, add @water{36%g} .

Make sure the coffee is saturated evenly, tamping slightly with the paddle or #butter knife{} if necessary, and let it sit for ~{30%seconds} .

Use the remainder of the hot water to fill the chamber.

After ~{1%minute} has elapsed, stir grounds 10 times to agitate.

Fasten the cap, ensuring it locks into the grooves tightly. Flip the whole assembly over with haste and control. Position it atop your brew vessel and begin applying downward pressure. If the pushing feels too easy, your grind is likely too coarse; if it’s very hard to push, chances are the grind is too fine. Your coffee is fully brewed once it begins to make a hissing sound.

Once you’ve unscrewed the cap, you can pop out the filter and the puck of condensed grounds by simply pushing AeroPress’s interior section a final inch.
17 changes: 17 additions & 0 deletions site/src/content/recipes/all-purpose-barbecue-sauce.cook
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
>> title: All Purpose Barbeque Sauce
>> source: https://www.amazon.com/Joshua-Weissman-Unapologetic-Cookbook/dp/1615649980?&_encoding=UTF8&tag=bsunter-20&linkCode=ur2&linkId=5300e43d60cfb8b95202ef018574abce&camp=1789&creative=9325
>> prep-time: 15 minutes
>> yield: 2 cups
>> image: https://tmbidigitalassetsazure.blob.core.windows.net/rms3-prod/attachments/37/1200x1200/East-Carolina-Barbecue-Sauce_EXPS_FT20_251998_F_0410_1_HOME2b.jpg
>> description: Good general purpose sweet bbq sauce
>> tags: southern, sauce

In a #medium saucepan{}, stir together @brown sugar{108%g} @ketchup{272%g} @molasses{63%g} @white distilled vinegar{60%ml} @garlic powder{10%g} @smoked paprika{7%g} @cayenne{4%g} @Worcestershire sauce{15%ml} @kosher salt{18%g} @black pepper{3%g}

Place over medium heat, and let the mixture come to a simmer.

Once simmering, continue cooking, stirring occasionally, for ~{8%minutes}, or until reduced and thickened slightly.

Pour the barbecue sauce into a #bowl{}. If you have a #smoking gun{}, cover the bowl with plastic wrap and slide the probe of the gun into the bowl. Fill the bowl with smoke, and remove the probe. Let sit, covered, for ~{5%minutes}. Stir, taste, and repeat 2 or 3 more times until smoky to your liking.

Serve how you like it! Store in an #airtight container{} in the refrigerator for up to 1 month.
26 changes: 26 additions & 0 deletions site/src/content/recipes/avocado-toast.cook
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
>> title: Avocado Toast
>> description: Simple avocado toast. The most important things are a hearty slice of bread and perfectly ripe avocados.
>>source: https://www.amazon.com/Joshua-Weissman-Unapologetic-Cookbook/dp/1615649980?&_encoding=UTF8&tag=bsunter-20&linkCode=ur2&linkId=5300e43d60cfb8b95202ef018574abce&camp=1789&creative=9325
>> tags: snack, vegetarian
>> prep time: 10 mins
>> cook time: 5 mins
>> servings: 1 serving
>> image: example.jpg

Toast the @bread either in a #toaster or in a pan with butter.

Spread very small amount of melted butter on toast.

Cut the @garlic{1%clove} in half, and rub the cut sides all over each slice of toast to perfume with garlic.

Mash the @avocado into chunks.

Mix splash of @lime and @salt into avocado mixture.

Spread avocado on the toast.

Optionally, Drizzle with the @chili oil{}

Add a generous pinch of flaky sea salt

Tear some basil and sprinkle on top
9 changes: 9 additions & 0 deletions site/src/content/recipes/banana-pancakes.cook
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
>> title: Banana Pancakes
>> description: You can make healthy pancakes out of a fluffy banana egg mixture.
>>source: https://www.amazon.com/Joshua-Weissman-Unapologetic-Cookbook/dp/1615649980?&_encoding=UTF8&tag=bsunter-20&linkCode=ur2&linkId=5300e43d60cfb8b95202ef018574abce&camp=1789&creative=9325
>> tags: breakfast, vegetarian
Combine @flour{120%g}, @white sugar{13%g}, @baking powder{2%tsp}, and @salt{1%g} in a bowl. Mix together @egg{3}, @milk{240%g}, @avocado oil{26%g}, and @bananas{3} in a second bowl.

Stir flour mixture into banana mixture; batter will be slightly lumpy.

Heat a lightly oiled griddle or frying pan over medium high heat. Pour or scoop the batter onto the griddle, using approximately 1/4 cup for each pancake. Cook until pancakes are golden brown, ~{5%minutes} per side. Serve hot.
22 changes: 22 additions & 0 deletions site/src/content/recipes/bbq-mixed-vegetables.cook
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
>> title: BBQ Vegetables
>> description: Marinated asian grilled vegetables
>> source: https://masterclass.com
>> tags: vegetarian
>> prep time: test
>> cook time: test
>> servings: 4 to 5 servings
>> image: example.jpg

Trim the @vegetables{4%lb} (asparagus, carrots, baby bok choy, fennel, onion, gem lettuce, etc.) and cut them into halves or quarters, depending on their size.

Add them to a large bowl or pan, and gently toss them with the @Kogi Vinaigrette{2%cup} . Let the vegetables sit for ~{30%minutes} while you heat the grill.

Prepare a pan for medium-high heat. Let it heat up for 5 to 10 minutes, then brush or spray the grates with a high-heat oil

Remove the vegetables from the Kogi Vinegrette.

Working in batches, grill them, turning once, until they’re charred all over, about ~{6%minutes} on each side. When they’re done, the veggies should be slightly tender but not soft, with distinct char marks.

Arrange the @sliced onions{2} in a heated #cast-iron pan{}, and lay the veggies on top.

Eat immediately.
17 changes: 17 additions & 0 deletions site/src/content/recipes/brown-butter-rice-krispy-treats.cook
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- Parsed Metadata
>> title: Caramelized Brown Butter Rice Krispies Treats
>> description: Browning the butter elevates these plebeian snacks into something more toothsome, and it adds just an extra couple of minutes to the process.
>> source: https://cooking.nytimes.com/recipes/11587-caramelized-brown-butter-rice-krispies-treats
>> tags: easy, desert
>> prep time: 5
>> cook time: 15
>> servings: 30 to 50 treats
>> image: https://static01.nyt.com/images/2017/01/29/dining/29COOKING-CRMLZDKRISPIETREAT1/29COOKING-CRMLZDKRISPIETREAT1-articleLarge.jpg

Line rimmed #sheet pan{} with #parchment paper{} or wax paper, or butter it well.

In a #large pot{}, melt @butter{8%ounces} over medium-low heat. It will melt, then foam, then turn clear golden and finally start to turn brown and smell nutty. Watch closely and stir often.

When butter is evenly browned, stir in @marshmallows{20%oz}. (If using unsalted butter, stir in 1/8 teaspoon salt.) Melt and cook, stirring often, until mixture turns pale brown, then stir constantly until lightly browned but not dark, ~{5%minutes} .

Turn off heat, add @Rice Krispies cereal{12%oz}, and mix well, preferably with a #silicone spoon{} or a spatula. Scrape into prepared pan and press down lightly. If necessary, butter hands to press mixture flat. Let cool, and cut into squares or bars.
20 changes: 20 additions & 0 deletions site/src/content/recipes/cinnamon-roasted-butternut-squash.cook
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
>> title: Cinnamon Roasted Butternut Squash
>> description: Easy Maple Cinnamon Roasted Butternut Squash. Cubes of butternut squash tossed with maple syrup, cinnamon, and rosemary, roasted to caramelized perfection.
>> source: https://www.wellplated.com/cinnamon-roasted-butternut-squash/
>> tags: healthy, side, vegetarian, vegan
>> prep-time: 10 minutes
>> cook-time: 30 minutes
>> servings: 4
>> image: https://www.wellplated.com/wp-content/uploads/2017/11/Cinnamon-Roasted-Butternut-Squash-Easy-butternut-squash-recipe.jpg

Position racks in the upper and lower thirds of your #oven and preheat the oven to 400 degrees F. Generously coat two #baking sheets{} with sprayed @avocado oil{}

Place the @squash cubes{2%lbs} in a large bowl. Drizzle with @avocado oil{2%tbsp} and @maple syrup{1%tbsp}, then sprinkle the @salt{1%tsp}, @cinnamon{.5%tsp}, and @pepper{.5%tsp} over the top.

Toss to coat, then divide between the two baking sheets, discarding any excess liquid with that collects at the bottom of the bowl. Spread the cubes in a single layer on the prepared baking sheets, taking care that they do not overlap.

Place the pans in the upper and lower thirds of your oven and bake for ~{15%minutes}.

Remove the pans from the oven, turn the cubes with a spatula, then return to the oven, switching the pans’ positions on the upper and lower racks.

Continue baking until the squash is tender, about ~{15%minutes}. Remove from the oven and sprinkle the @chopped fresh rosemary{1%tablespoon} over the top. Serve warm.
22 changes: 22 additions & 0 deletions site/src/content/recipes/crepes.cook
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
>> title: Crepes
>> description: A simple crepe batter that'll allow you to whip up French crepes for breakfast, lunch, or dinner.
>> source: https://www.seriouseats.com/basic-crepes-batter-recipe
>> tags: french, bread, breakfast
>> prep time:
>> cook time:
>> servings: 4 to 5 servings
>> image: https://www.seriouseats.com/thmb/zgYU1HH-dGpqUEjRBRHGAxMvDBM=/1500x1125/filters:fill(auto,1)/__opt__aboutcom__coeus__resources__content_migration__serious_eats__seriouseats.com__images__2017__02__20170206-spinach-egg-cheese-crepe-15-567951c183f74f4c89c172e2c5910670.jpg

Combine @large eggs{2} , @whole milk{280%ml}, @flour{140%g}, @melted butter{15%ml}, @pinch salt{}, and @sugar{8%g} (if using) in a #blender{} .

Start blender on low speed and increase to high. Blend until smooth, about ~{10%seconds}. Add herbs (if using, such as such as parsley, tarragon, chervil, or chives) and pulse to combine.

Heat a 10-inch nonstick or well-seasoned #cast iron{} or carbon steel skillet over medium heat for 2 minutes. Lightly grease with oil or butter, using a paper towel to wipe out the excess.

Hold the pan's handle in one hand and pour in 3 to 4 tablespoons (45 to 60ml) batter, swirling and tilting pan immediately to spread batter in a thin, even layer over bottom of pan.

Let cook until top looks dry, about ~{20%seconds} . Using a thin metal or #nylon spatula{}, lift one edge of crepe. Grab that edge with the fingers of both hands and flip crepe. Cook on second side for 10 seconds, then transfer to a plate. Repeat with remaining batter.

Fill crepes as desired (such as with butter, sugar, and lemon juice; with butter and jam; with ham, cheese, and eggs; or with spinach and feta) and serve.

Crepes can also be made ahead and stored, unfilled and wrapped in plastic, in the refrigerator for up to 3 days. Reheat in a nonstick pan to serve.
17 changes: 17 additions & 0 deletions site/src/content/recipes/east-carolina-bbq-sauce.cook
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
East Carolina BBQ Sauce
>> source: https://www.tasteofhome.com/recipes/east-carolina-bbq-sauce/
>> prep-time: 5 minutes
>> image: https://tmbidigitalassetsazure.blob.core.windows.net/rms3-prod/attachments/37/1200x1200/East-Carolina-Barbecue-Sauce_EXPS_FT20_251998_F_0410_1_HOME2b.jpg
>> description: Thin, spicy, and vinegery BBQ sauce.
Combine
@cider vinegar{230%g} (1 cup)
@brown sugar{13%g}
@coarsely ground pepper{6%g} (2 tsp)
@hot pepper sauce{8%g} (2 tsp)
@salt{4%g} (1 tsp)
@crushed red pepper flakes{6%g} (1 tsp)
in a jar or shaker.

Seal and shake until sugar has completely dissolved.

Use or store at room-temperature for up to 2 weeks.
Loading

0 comments on commit d529d9f

Please sign in to comment.