feat(cli): render markdown tables and formatting in non-streaming responses - #4245
Closed
crazywriter1 wants to merge 1 commit into
Closed
feat(cli): render markdown tables and formatting in non-streaming responses#4245crazywriter1 wants to merge 1 commit into
crazywriter1 wants to merge 1 commit into
Conversation
Use rich.Markdown for non-streaming Panel output when markdown content is detected (tables, headings, code blocks, lists). Falls back to existing ANSI rendering for plain text. Fixes NousResearch#3621
2 tasks
Contributor
|
Thanks for the PR, @crazywriter1! This has since been implemented on This is an automated hermes-sweeper review. What landed on main:
One design difference: the main implementation requires users to opt in with Closing as |
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.
Summary
Fixes #3621 - CLI now renders markdown (tables, headings, code blocks, lists) properly in non-streaming mode instead of displaying raw syntax like
| header | header |.Changes
_looks_like_markdown()heuristic that detects markdown content by checking for 2+ indicators (tables, headings, fenced code blocks, ordered/unordered lists)_render_response_content()that returnsrich.Markdownwhen markdown is detected, falls back to existing_rich_text_from_ansi()for plain text/btwside-question response panel (~L4308)What's NOT changed
rich.Markdownis already available via the existingrich>=14.3.3requirementWhy a heuristic?
Blindly passing every response through
rich.Markdownwould break plain text and ANSI colored tool output. The 2-indicator threshold avoids false positives (e.g. a line starting with#in a shell command won't trigger markdown rendering on its own).Test plan
stream: falseand confirm it renders as a formatted tableFuture work
Streaming markdown rendering (#3621 streaming case) is intentionally deferred to a separate PR. It involves UX tradeoffs (buffering vs re-rendering vs incremental parsing) that deserve their own discussion.