Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

feat: redesign Markdown export β€” cleaner structure, no watermark

Luis Ortiz206b1351c906
diff --git a/src/core/export/markdown-export.ts b/src/core/export/markdown-export.ts
index 49c8f99..f299516 100644
--- a/src/core/export/markdown-export.ts
+++ b/src/core/export/markdown-export.ts
@@ -12,30 +12,48 @@ function blobToBase64(blob: Blob): Promise<string> {
});
}
+function extractDomain(steps: Step[]): string | null {
+ const stepWithUrl = steps.find((s) => s.url);
+ if (!stepWithUrl) return null;
+ try {
+ return new URL(stepWithUrl.url).hostname.replace(/^www\./, '');
+ } catch {
+ return null;
+ }
+}
+
+function formatDate(timestamp: number): string {
+ return new Date(timestamp).toLocaleDateString('en-US', {
+ month: 'short',
+ day: '2-digit',
+ year: 'numeric',
+ });
+}
+
export async function exportGuideAsMarkdown(
guide: Guide,
steps: Step[],
screenshots: Map<string, Screenshot>,
): Promise<string> {
- const lines: string[] = [
- `# ${guide.title}`,
- '',
- `*${steps.length} steps β€” Created ${new Date(guide.createdAt).toLocaleDateString()}*`,
- '',
- ];
+ const domain = extractDomain(steps);
+ const meta = [
+ `${steps.length} steps`,
+ `Created ${formatDate(guide.createdAt)}`,
+ ...(domain ? [`Source: ${domain}`] : []),
+ ].join(' Β· ');
+
+ const lines: string[] = [`# ${guide.title}`, '', `*${meta}*`, '', '---', ''];
for (const step of steps) {
- lines.push(`## Step ${step.index + 1}: ${step.description}`);
- lines.push('');
+ const num = String(step.index + 1).padStart(2, '0');
+ lines.push(`## Step ${num}: ${step.description}`, '');
+
const screenshot = screenshots.get(step.id);
if (screenshot) {
const b64 = await blobToBase64(screenshot.blob);
- lines.push(`![Step ${step.index + 1}](data:${screenshot.mimeType};base64,${b64})`);
- lines.push('');
+ lines.push(`![Step ${num}](data:${screenshot.mimeType};base64,${b64})`, '');
}
}
- lines.push('---');
- lines.push('*Generated by Mimik*');
return lines.join('\n');
}