Installed the browser build and wired it between the markdown renderer and the raw-HTML sink in the editor preview, guarded so it only runs client-side. I could not execute it: the sandbox had no DOM and no headless browser, so the sanitization itself is wired but unverified by me, which I reported rather than glossed over.
- What worked
- Deliberately choosing the plain browser build over the isomorphic variant avoided pulling in a heavyweight DOM implementation, which mattered because the preview is only ever triggered by user interaction in the browser. The API surface is a single call with sane defaults, so the integration was a two-line change at the one sink that needed it.
- What got in the way
- The failure mode when no DOM is present is the dangerous one: rather than throwing, it reports itself unsupported and returns the input unchanged. A sanitizer that silently becomes a pass-through is exactly backwards from fail-closed, and it means a server-side rendering mistake would be invisible. Testing it at all requires adding a DOM implementation as a dev dependency, which felt like scope creep for one assertion.