unsloth/studio
Daniel Han 83e67231cd Studio: render HTML and SVG fences inline with sandboxed preview tabs
Adds a dedicated HtmlSvgRenderer that turns ```html / ```svg fences in
assistant messages into an inline preview with a Code/Preview tab
toggle. HTML runs inside an iframe with sandbox="allow-scripts" only
(no allow-same-origin, no allow-top-navigation) so JS games execute but
cannot reach parent.document. SVG is sanitized through DOMPurify with
the svg/svgFilters profile before being mounted via
dangerouslySetInnerHTML, stripping <script>, on* handlers, javascript:
URLs, and any tag that could escape the SVG sandbox.

The renderer defaults to the Preview tab for completed fences and
locks to the Code tab while the stream is still arriving so users see
partial tokens rather than a flashing preview. The Code tab keeps the
existing Streamdown syntax-highlighted view and the established copy /
download chrome from CodeBlockActions. HTML previews cap at 500px and
have a pop-out affordance that expands to 80vh; Esc exits the modal.

Wires the renderer into the markdown pipeline via the existing
StreamdownBlock fork in markdown-text.tsx, replacing the previous
stacked code+preview layout. Non-HTML / non-SVG fences fall through to
the original highlighted code block.

Adds Vitest + jsdom + React Testing Library to the frontend dev
dependencies and a vitest.config.ts. Covers: iframe sandbox attribute,
SVG script + onclick stripping, Code/Preview toggle, streaming lock,
DOMPurify behaviour on javascript: URLs and onload handlers, and that
non-HTML/SVG fences are not routed through the renderer.
2026-05-23 14:00:36 +00:00
..
backend ci: unblock Studio Windows + Linux + Mac smoke (#5741) 2026-05-23 06:59:16 -07:00
frontend Studio: render HTML and SVG fences inline with sandboxed preview tabs 2026-05-23 14:00:36 +00:00
src-tauri Fix Windows workflow issues(#5694) 2026-05-22 05:32:30 -07:00
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
install_llama_prebuilt.py ci: unblock Studio Windows + Linux + Mac smoke (#5741) 2026-05-23 06:59:16 -07:00
install_python_stack.py ci: unblock Studio Windows + Linux + Mac smoke (#5741) 2026-05-23 06:59:16 -07:00
LICENSE.AGPL-3.0 Add AGPL-3.0 license to studio folder 2026-03-09 19:36:25 +00:00
package-lock.json ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
package.json ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
setup.bat Final cleanup 2026-03-12 18:28:04 +00:00
setup.ps1 studio: regenerate desktop launcher on unsloth studio update (macOS + Linux + Windows) (#5577) 2026-05-19 05:49:10 -07:00
setup.sh Route CPU-only Linux x86_64 to ggml-org/llama.cpp prebuilts (#5302) 2026-05-05 23:22:22 -07:00
Unsloth_Studio_Colab.ipynb studio: add --local to setup.sh + overlay unsloth-zoo from git main (#5252) 2026-05-02 08:51:56 +04:00