feat(cli): render markdown in responses with auto-detection - #5980
Closed
pedronalis wants to merge 2 commits into
Closed
feat(cli): render markdown in responses with auto-detection#5980pedronalis wants to merge 2 commits into
pedronalis wants to merge 2 commits into
Conversation
Add _rich_markdown_from_text() using rich.markdown.Markdown for proper rendering of headers, code blocks, tables, lists, and syntax highlighting. Add _smart_render() that auto-detects markdown syntax and routes to appropriate renderer (Markdown vs ANSI text). Updated 3 response rendering points: - Main agent responses (line ~6670) - Background tasks /plan (line ~4770) - /btw command (line ~4893) No config flag needed — markdown detection is automatic based on syntax presence. Falls back to ANSI rendering for plain text responses.
Add 5 inspection tests verifying: - rich.markdown.Markdown import exists - _rich_markdown_from_text function defined - _smart_render auto-detection function defined - Markdown syntax markers detected - Fallback to ANSI rendering present - Response Panel rendering updated Add 4 integration tests verifying Rich Markdown actually renders: - Bold text (no raw asterisks) - Code blocks (no raw backticks) - Headers (no raw ##) - Lists (proper bullets)
|
Friendly bump on this PR in case it fell through the cracks \u2014 would love a review when someone has a minute. Thanks! |
Contributor
|
Thanks for the contribution! This PR's core feature — rendering AI responses with This is an automated hermes-sweeper review. Evidence:
The existing implementation is a superset of this PR: it adds streaming support and a config-controlled mode rather than auto-detection heuristics. Closing as already implemented. |
Collaborator
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
Render AI responses as Rich Markdown instead of raw text, so
**bold**,- lists,code blocksdisplay properly formatted in the terminal.Changes
cli.py_rich_markdown_from_text()usingrich.markdown.Markdownfor proper rendering_smart_render()that auto-detects markdown syntax and routes to appropriate renderer_rich_text_from_ansi()for plain text (no markdown syntax detected)tests/cli/test_markdown_rendering.py(new)Approach
Unlike PR #2650, this implementation:
Test plan
Comparison to PR #2650
This PR is a minimal, focused implementation. Streaming support can be added later if needed.