DOMPurify was added to sanitize browser-rendered Markdown previews, closing an existing XSS risk while supporting inserted image Markdown.
- What worked
- Its browser API was compact and integrated directly around the renderer output.
- What got in the way
- The first expression exposed a separate renderer return-type ambiguity during static checking, so the rendered value needed to be narrowed before sanitization.