Rehype HTML Playground
Pick plugins, run them on your HTML and compare the source with the result. The preview is sanitized and rendered in a sandboxed frame with scripts disabled.
What runs, and in which order
Only the plugins listed above can run. They always run in this order, whatever order you tick them in: sanitize, slug, autolink headings, external links, highlight, then format or minify. That mirrors a sensible real pipeline: sanitize untrusted input first, then let trusted plugins add ids, links and highlighting.
rehype-autolink-headingsruns withbehavior: 'wrap'and needs heading ids, so enablerehype-slugwith it.rehype-external-linksaddstarget="_blank"andrel="nofollow noopener noreferrer"tohttpandhttpslinks.rehype-highlighthighlights code blocks that have alanguage-*class, using lowlight's "common" set of 37 languages. Highlight colors appear in the preview.- The minify option uses the same browser subset of
rehype-preset-minifyas the HTML Minifier.
Preview safety
The output pane shows the pipeline result as escaped code, exactly as produced. The preview is different: it is passed through rehype-sanitize again (with highlight classes allowed) and displayed in an <iframe sandbox> without allow-scripts, so scripts, event handlers, forms and navigation cannot run. Remote image addresses are removed from the preview, and the frame's security policy blocks remote loading as well, so pasted HTML cannot make your browser contact other servers. The playground never loads packages from npm and never executes code you type.
Packages used
rehype-slug, rehype-autolink-headings, rehype-external-links, rehype-highlight, rehype-sanitize, rehype-format, rehype-preset-minify, bundled locally from npm and run in a Web Worker. Your input stays on your device.
Other tools: HTML Formatter · HTML Minifier · HTML Sanitizer · HTML to Markdown · Plugin Explorer