feat: Enhance recipeToMarkdown to include source URL in output
This commit is contained in:
@@ -122,7 +122,7 @@ export class QuickImportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Konvertera till Markdown-format
|
// Konvertera till Markdown-format
|
||||||
const markdown = this.recipeToMarkdown(recipe);
|
const markdown = this.recipeToMarkdown(recipe, url);
|
||||||
console.log('[QuickImport] Markdown genererad, längd:', markdown.length);
|
console.log('[QuickImport] Markdown genererad, längd:', markdown.length);
|
||||||
|
|
||||||
// Detektera källa från URL
|
// Detektera källa från URL
|
||||||
@@ -147,16 +147,19 @@ export class QuickImportService {
|
|||||||
/**
|
/**
|
||||||
* Konvertera receptobjekt till Markdown-format
|
* Konvertera receptobjekt till Markdown-format
|
||||||
*/
|
*/
|
||||||
private recipeToMarkdown(recipe: {
|
private recipeToMarkdown(
|
||||||
name: string;
|
recipe: {
|
||||||
description?: string;
|
|
||||||
ingredients: Array<{
|
|
||||||
quantity: number;
|
|
||||||
unit: string;
|
|
||||||
name: string;
|
name: string;
|
||||||
}>;
|
description?: string;
|
||||||
instructions?: string;
|
ingredients: Array<{
|
||||||
}): string {
|
quantity: number;
|
||||||
|
unit: string;
|
||||||
|
name: string;
|
||||||
|
}>;
|
||||||
|
instructions?: string;
|
||||||
|
},
|
||||||
|
sourceUrl?: string,
|
||||||
|
): string {
|
||||||
const lines: string[] = [];
|
const lines: string[] = [];
|
||||||
|
|
||||||
// Titel
|
// Titel
|
||||||
@@ -184,6 +187,14 @@ export class QuickImportService {
|
|||||||
if (recipe.instructions) {
|
if (recipe.instructions) {
|
||||||
lines.push('## Tillvägagångssätt');
|
lines.push('## Tillvägagångssätt');
|
||||||
lines.push(recipe.instructions);
|
lines.push(recipe.instructions);
|
||||||
|
lines.push('');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Källa
|
||||||
|
if (sourceUrl) {
|
||||||
|
lines.push('---');
|
||||||
|
lines.push('');
|
||||||
|
lines.push(`Källa: [${sourceUrl}](${sourceUrl})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return lines.join('\n');
|
return lines.join('\n');
|
||||||
|
|||||||
Reference in New Issue
Block a user