Parent
Confirmed parity gap
Home ANSI rendering writes document-controlled bytes directly through paragraph text, decoded entities, link hrefs, image src/title, code-fence language badges, and image URL collection. Bun live Rust routes all of those surfaces through sanitize_source_text, removing C0/DEL/C1 controls and complete CSI/OSC sequences before they can reach terminal output. Home only strips escapes from one image-alt path, so OSC 52 clipboard writes, OSC title changes, CSI queries, BEL terminators, and related controls can survive through the other sinks.
The copied Bun corpus already carries exact regressions in js/bun/md/md-edge-cases.test.ts for source text and link/metadata controls.
Scope
- Port Bun sanitize_source_text as a shared Zig helper with an allocation-free fast path.
- Apply it to text, decoded entities, href construction, image metadata, code badges, and collected image URLs.
- Preserve renderer-owned lifetimes and propagate or record allocation failure through the existing paths.
- Verify ordinary text and URLs remain byte-for-byte unchanged and hostile C0/C1/CSI/OSC input is removed.
This is the direct Bun implementation, not an assertion or test workaround.