type CollectionMarkdownInput = { name: string; description: string | null; recipes: Array<{ title: string; description: string | null; baseServings: number; prepMins: number | null; cookMins: number | null; difficulty: "easy" | "medium" | "hard" | null; }>; }; export function collectionToMarkdown(collection: CollectionMarkdownInput): string { const lines: string[] = [`# ${collection.name}`, ""]; if (collection.description) { lines.push(collection.description, ""); } for (const recipe of collection.recipes) { lines.push(`## ${recipe.title}`, ""); if (recipe.description) lines.push(recipe.description, ""); const meta: string[] = [`Servings: ${recipe.baseServings}`]; if (recipe.prepMins) meta.push(`Prep: ${recipe.prepMins} min`); if (recipe.cookMins) meta.push(`Cook: ${recipe.cookMins} min`); if (recipe.difficulty) meta.push(`Difficulty: ${recipe.difficulty}`); lines.push(meta.join(" ยท "), ""); } return lines.join("\n").trim() + "\n"; }