DevTools Logo

Markdown Artifacts Previewer

Markdown Artifacts Previewer

Render LLM code, SVG, HTML, and markdown artifacts safely in your browser

Paste LLM output

Only fenced SVG and HTML are rendered. Mermaid, JSX, and other languages remain code.

About

A deterministic client-side parser for fenced code blocks in LLM output. SVG and HTML are previewed in a sandboxed iframe with no allow-scripts permission; Mermaid, JSX, and other languages remain visible source code. Markdown prose is rendered separately.

Examples

SVG plus mermaid

Input
parseMarkdownArtifacts("Before\n```svg\n<svg><circle /></svg>\n```\n```mermaid\nflowchart TD\n```\nAfter")
Output
{ artifacts: [{ language: "svg", kind: "svg" }, { language: "mermaid", kind: "code" }] }

Two artifacts split out while Before/After prose stays in the markdown body.

HTML fragment wrapper

Input
parseMarkdownArtifacts("```html\n<h1>Hello</h1>\n```")
Output
{ srcdoc: "<!doctype html>...<h1>Hello</h1>..." }

Bare fragments become full documents without any allow-scripts token.

About this tool

Markdown Artifacts Previewer splits LLM output with parseMarkdownArtifacts: fenced blocks become ArtifactBlock entries ({ id, language, code, kind, renderable, srcdoc }) while surrounding prose stays in the markdown body. SVG and HTML kinds are renderable with srcdoc set; mermaid, jsx, and other languages stay code-only with no srcdoc.

Previews are sandbox-safe: HTML fragments are wrapped into a complete <!doctype html> document and rendered in an iframe with sandbox="" (empty string, no allow-scripts), so scripts never execute while markup still previews.

Empty input returns { markdown: "", artifacts: [] }, and renderMarkdownToText strips headings, bold, inline code, and list markers for the prose pane — all deterministic and client-side.

How to use this tool

  1. Paste LLM markdown

    Drop mixed prose plus fenced svg, html, mermaid, or jsx blocks into the parser.

  2. Preview renderables

    Render svg and html artifacts via srcdoc in a sandbox="" iframe with no script permission.

  3. Keep code as code

    Leave mermaid diagrams and jsx components as source text — they get kind code and no srcdoc.

Use cases

Reviewing LLM-generated SVG

Isolate vector output from chat prose and preview it without executing anything.

Checking LLM HTML snippets

Wrap fragments into documents and eyeball layout in a script-free iframe.

Triaging mixed model output

Separate renderable artifacts from mermaid and jsx code that needs a different renderer.

Common mistakes

Mistake:Expecting mermaid or jsx to preview.

Fix:Only svg and html are renderable — mermaid and jsx intentionally return kind code with no srcdoc.

Mistake:Adding allow-scripts to the preview iframe.

Fix:Keep sandbox="" empty; scripts in model output must never run in the preview context.

Frequently asked questions

What does this tool do?

It splits LLM markdown with parseMarkdownArtifacts into prose plus svg/html artifacts (renderable via srcdoc) while mermaid, jsx, and other languages stay code-only.

How are previews sandboxed?

Render the srcdoc in an iframe with sandbox="" (empty string) — HTML is wrapped into a full document with no allow-scripts token, so nothing executes.

Is my pasted markdown uploaded or stored?

No. Fence parsing and text rendering run fully client-side.

Why does my mermaid or jsx block not preview?

By design only svg and html get kind svg/html with srcdoc — mermaid and jsx return kind code with renderable false and no srcdoc.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML