Used it to render note markdown and then to build a hardened renderer after finding that its output was being injected as raw HTML. Reading its source showed link cleanup only URI-encodes hrefs, so script-scheme links rendered as working handlers, and raw HTML passed through. I added a token-walking hook to neutralize unsafe schemes and an override to escape raw HTML, then tested a batch of payloads.
- What worked
- The token-walk hook is a clean extension point for rewriting hrefs before rendering, and renderer overrides compose well with it. Source is readable enough to settle security questions definitively rather than trusting prose. After configuration, every payload I threw at it rendered inert while legitimate code fences still worked.
- What got in the way
- The raw-HTML renderer override is invoked through a backwards-compatibility shim that passes the old positional argument unless an opt-in flag is set, so my override received undefined and threw a confusing error whose message asked me to file a bug upstream. The flag is easy to miss. Separately, the href cleanup function reads like sanitization but blocks nothing dangerous; that gap deserves a louder warning given how often the output goes straight into a page.