You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Preview renders HTML files (sandboxed, scripts off, local images inlined) #2141
Problem — Preview opens .html files as source text, so an agent-written status page cannot be read in the studio. Approach — Render .html/.htm in Preview inside a scripts-off, same-origin sandboxed frame. The host prepares the document first: strips scripts, meta refresh, base and embedded frames; inlines locally referenced images as data URIs; then intercepts link clicks. A Rendered/Source toggle mirrors Markdown's, and the existing zoom controls apply. Scope — in: rendering, preparation, image inlining, link routing, toggle, zoom, scroll kept across re-renders · out: live-refresh extensions (sub-issue 2), pop-out (sub-issue 3), page scripts.
Acceptance Criteria
An .html or .htm file opens rendered by default; the toggle switches to the source editor and back; saving from Source re-renders.
Scripts, inline event handlers and meta refresh in the page have no effect (the prepared document contains no script, meta refresh, base, iframe, object or embed elements).
Relative, absolute-path and file:// image sources are resolved against the page's folder and inlined; https and data sources are left alone; inlining stops at a fixed count and size budget.
https link clicks open the system browser; relative and file:// link clicks open the target in Preview for the same session; in-page #anchor links scroll; nothing navigates the frame.
Zoom in/out/reset changes the page scale; re-rendering the same file keeps the scroll position.
Testing Decisions
Pure preparation and link classification live in their own module with unit tests (happy-dom: script/refresh stripping, image path resolution, budget, link classes). Extend the Preview routing test for the new category.
Key Decisions
The sandbox allows same-origin and never scripts. Image bytes come through the engine's file read, which already serves image/PDF bytes to Preview.
Activity