Repository navigation
fix(cli): preserve trailing block separators in streamed markdown (Fixes #3257) - #3312
Merged
Merged
Conversation
When markdown is streamed chunk-by-chunk, block-level elements (paragraphs, headings, code blocks, lists) need trailing newlines to prevent consecutive chunks from running together on the same line. This fix: - Refactors render_markdown() to use a new render_markdown_raw() helper - Adds markdown_to_ansi_stream() for stream-aware rendering that preserves trailing newlines from block elements - Updates MarkdownStreamState::push() to use markdown_to_ansi_stream() instead of markdown_to_ansi() - Adds a test verifying that streamed blocks remain visually separated Fixes #3257
This was referenced Oct 12, 2026
|
The |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Missing newlines before paragraphs and code blocks in streamed Markdown cause consecutive chunks to run together on the same line.
Solution
render_markdown()to use a newrender_markdown_raw()helper that preserves trailing whitespacemarkdown_to_ansi_stream()for stream-aware rendering that preserves block-level element newlinesMarkdownStreamState::push()to usemarkdown_to_ansi_stream()instead ofmarkdown_to_ansi()Test Results
stream_rendering_preserves_block_separatorspasses