fix(backend): rendering issue

This commit is contained in:
2025-01-19 21:11:38 +01:00
parent 5fac6de05a
commit 463141981b
7 changed files with 635 additions and 16 deletions

View File

@@ -46,7 +46,10 @@ export const unitsOfMeasure = {
export function parseIngredients(
text: string,
): (Ingredient | IngredientGroup)[] {
const cleanText = removeMarkdownFormatting(text);
const cleanText = removeMarkdownFormatting(text)
.split("\n")
.map((line) => line.trim().replace(/^-/, ""))
.join("\n");
const ingredients = parseIngredient(cleanText, {
normalizeUOM: true,

View File

@@ -160,6 +160,11 @@ export function renderRecipe(recipe: Recipe) {
item.unit?.trim() || ""
}** ${item.name}`;
}
if (item.quantity) {
return `- **${item.quantity}** ${item.name}`;
}
return `- ${item.name}`;
})
.join("\n");