π¬ A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots π
TypeScript browser-extensionchrome-extensiondocumentationfirefox-extensionguide-generatorlocal-firstmanifest-v3privacy-firstproductivityreactscreenshotstep-by-step-guidetutorialtypescriptworkflowwxt
fix(export): label embedded images with the rendered mime type
Luis Ortizd1ef8d0a64ec
diff --git a/src/core/export/__tests__/markdown-export.test.ts b/src/core/export/__tests__/markdown-export.test.tsindex 2296cb8..16a34df 100644--- a/src/core/export/__tests__/markdown-export.test.ts+++ b/src/core/export/__tests__/markdown-export.test.ts@@ -139,6 +139,17 @@ describe('exportGuideAsMarkdown', () => {expect(md).toContain(b64);});+ it('labels the data URL with the rendered mime type, not the stored one', async () => {+ const step = makeStep();+ const ss = makeScreenshot(step.id, 'pixel-data');+ ss.mimeType = 'image/jpeg';++ const md = await exportGuideAsMarkdown(makeGuide(), [step], new Map([[step.id, ss]]));++ expect(md).toContain('](data:image/png;base64,');+ expect(md).not.toContain('data:image/jpeg');+ });+it('renders a heading block as an H2 without a step number', async () => {const guide = makeGuide();const steps = [makeStep({ id: 'block-1', blockType: 'heading', description: 'Section title', url: '' })];diff --git a/src/core/export/html-export.ts b/src/core/export/html-export.tsindex 4c6fa39..80d2082 100644--- a/src/core/export/html-export.ts+++ b/src/core/export/html-export.ts@@ -59,9 +59,10 @@ export async function exportGuideAsHTML(const screenshot = opts.screenshots ? screenshots.get(step.id) : undefined;let imgHtml = '';if (screenshot) {- const b64 = await blobToBase64(await renderScreenshot(screenshot));+ const rendered = await renderScreenshot(screenshot);+ const b64 = await blobToBase64(rendered);const altText = screenshot.edits?.alt || i18n.t('export.stepLabel', [String(number)]);- imgHtml = `<img src="data:${screenshot.mimeType};base64,${b64}" alt="${escapeHtml(altText)}" style="display:block;width:${imgWidthPct}%;margin-top:14px;border:1px solid #CBD5E1;" />`;+ imgHtml = `<img src="data:${rendered.type};base64,${b64}" alt="${escapeHtml(altText)}" style="display:block;width:${imgWidthPct}%;margin-top:14px;border:1px solid #CBD5E1;" />`;}const stepNumber = String(number).padStart(2, '0');diff --git a/src/core/export/markdown-export.ts b/src/core/export/markdown-export.tsindex 302c848..53da7d7 100644--- a/src/core/export/markdown-export.ts+++ b/src/core/export/markdown-export.ts@@ -39,9 +39,10 @@ export async function exportGuideAsMarkdown(const screenshot = screenshots.get(step.id);if (screenshot) {- const b64 = await blobToBase64(await renderScreenshot(screenshot));+ const rendered = await renderScreenshot(screenshot);+ const b64 = await blobToBase64(rendered);const altText = screenshot.edits?.alt || i18n.t('export.stepLabel', [num]);- lines.push(``, '');+ lines.push(``, '');}}