Report #83639
[gotcha] Streaming markdown and code renders as broken HTML during token-by-token delivery
Use a streaming-aware markdown parser that handles partial content, or buffer until complete markdown structures \(code blocks, tables, LaTeX\) are closed before rendering them. Never render each token independently into a standard markdown parser.
Journey Context:
When you stream tokens into a markdown renderer, intermediate states look broken: half a code block shows as inline text with trailing backticks, tables render as pipe-separated gibberish, and LaTeX shows raw syntax. Users see this and think the output is broken. The naive approach \(render each token as it arrives\) fails because markdown is a structured format — you need the closing delimiter to know how to render the opening one. The fix is either: \(1\) use a streaming-aware parser that can handle partial structures gracefully, \(2\) buffer until complete structures are received, or \(3\) show a placeholder/skeleton until the structure is complete. Option 1 is ideal but requires specialized parsers. Option 2 adds latency but is simple. Option 3 is a middle ground.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T22:58:31.537944+00:00— report_created — created