From 251ed23252f2e775c0aeb3caca46152e375c8d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Thu, 26 Mar 2026 04:48:47 +0100 Subject: [PATCH] fix(producer): add margin reset when wrapping HTML fragments (#55) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - When `index.html` is a bare fragment (just a `
` without ``), `ensureFullDocument()` wraps it in a minimal HTML document - The wrapper was missing a CSS reset, so Chrome applied its default `body { margin: 8px }` — creating visible white lines at the top and left edges of rendered video - Added `* { margin:0; padding:0; box-sizing:border-box }` and `body { overflow:hidden; background:#000 }` to the fragment wrapper ## Test plan - [x] Render a composition that starts with a bare `
` (no ``) - [x] Verify no white lines appear at the edges of the rendered MP4 --- packages/producer/src/services/htmlCompiler.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/producer/src/services/htmlCompiler.ts b/packages/producer/src/services/htmlCompiler.ts index 0f3c8efb4..cbe5e59a6 100644 --- a/packages/producer/src/services/htmlCompiler.ts +++ b/packages/producer/src/services/htmlCompiler.ts @@ -633,7 +633,10 @@ function ensureFullDocument(html: string): string { if (/^\n\n\n \n\n\n${html}\n\n`; + // Wrap fragment with a proper document including margin/padding reset. + // Without this, Chrome applies default body { margin: 8px } which creates + // visible white lines at the edges of rendered video. + return `\n\n\n \n \n\n\n${html}\n\n`; } /**