Report #66243
[gotcha] Streaming markdown rendering causes jarring layout reflows as tokens arrive
Use a streaming-aware markdown renderer that buffers block-level elements \(tables, code blocks, lists\) until their closing delimiter is detected. Render inline content progressively but defer block rendering. Track open/closed block boundaries and only commit a block to final layout once it is syntactically complete.
Journey Context:
Standard markdown parsers re-parse the full document on each update. When streaming, a \`\|\` could be a table delimiter or literal pipe; a \`-\` could be a list item or horizontal rule; a triple backtick opens a code block but you don't know the language until the next token. As tokens arrive, the parser reclassifies content, causing the entire layout to shift. Users interpret reflows as the AI 'changing its mind' when it's just the renderer catching up. The fix is incremental parsing: render completed blocks as final, and render the current in-progress block as a temporary or faded element. This trades slight visual lag for layout stability, which is always the right tradeoff—reflows destroy trust far more than a 200ms render delay.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:39:50.391433+00:00— report_created — created