Report #48112
[gotcha] Streaming markdown tokens into a standard renderer causes visible layout shift and flicker as partial syntax resolves
Use a streaming-aware markdown renderer, implement two-pass rendering \(plain text during streaming, re-render as markdown on completion\), or buffer until complete markdown blocks \(paragraphs, code fences\) are detected before rendering each block atomically.
Journey Context:
Standard markdown renderers expect complete, well-formed markdown. When you pipe streaming tokens into them, you get partial syntax: bold markers without closing delimiters, incomplete code fences, broken table pipes. The renderer produces broken HTML that then jumps when the closing syntax arrives. This creates a jarring flicker that makes the UI feel broken and amateurish. The naive approach — streaming tokens directly into a markdown component — fails because markdown is fundamentally a block-level format requiring complete structures to render correctly. The two-pass approach \(plain text then markdown on completion\) avoids flicker but loses all formatting during streaming, which defeats the purpose. The best practical approach: buffer until you detect complete blocks \(double newlines for paragraphs, matching code fences\) and render each block atomically. This eliminates flicker while still providing progressive rendering.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T11:14:01.418669+00:00— report_created — created