feat(cli): add Markdown and syntax-highlighted code block rendering - #5617
Closed
pcomte3 wants to merge 13 commits into
Closed
feat(cli): add Markdown and syntax-highlighted code block rendering#5617pcomte3 wants to merge 13 commits into
pcomte3 wants to merge 13 commits into
Conversation
…th slash command to enable/disable
Author
|
@teknium1 This PR adds Markdown rendering support to the Hermes CLI — syntax-highlighted code blocks, inline formatting (bold/italic/headers/lists/etc.), and formatted pipe tables with box-drawing borders. Works for both streaming and non-streaming modes with no new dependencies. Toggleable via |
- Extend header support from h1-h4 to h1-h6 - Stricter fence detection: reject ```text mid-line, require clean ```lang or bare ``` - Protect inline code spans from bold/italic regex corruption (sentinel extraction) - Conservative bold/italic/strikethrough matching: require non-whitespace boundaries - Rewrite _apply_inline_markdown with explicit processing order instead of generic loop - Add 9 new tests for robustness (unmatched markers, mid-text backticks, code protection)
Author
|
Update: 2 additional commits pushed.
|
… renderer Headers (# through ######) returned early without processing **bold**, *italic*, or `code` markers in their text content. Now strips these markers before rendering, so `### 1. **Bug Title**` displays cleanly.
Extract _strip_inline_markers() helper (shared with headers) to remove **bold**, *italic*, ~~strike~~, and `code` markers from table cell text. Applied during parsing so column widths are computed on clean text.
This was referenced Apr 22, 2026
4 tasks
19 tasks
This was referenced Aug 1, 2026
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
MarkdownStreamProcessor) with regex-based ANSI transforms for inline formatting and per-line Pygments highlighting for fenced code blocksMarkdownclass inside the existing Panel for full AST-based renderingdisplay.markdown(default:true) and toggleable at runtime with/markdown(alias/md)Features
┌───python───,└───)display.code_themeor per-skincode_themeYAML field```markdown/```mdfences transparently skipped (common LLM behavior of wrapping entire responses)\*,\_,\~,\`correctly preserved as literal textFiles changed
hermes_cli/markdown_stream.pycli.py/markdowncommand, theme resolverhermes_cli/config.pydisplay.markdownanddisplay.code_themedefaultshermes_cli/skin_engine.pycode_themefield onSkinConfighermes_cli/commands.py/markdowncommand registrationtests/test_markdown_stream.pyTest plan
pytest tests/test_markdown_stream.py— 52 tests pass/markdowntoggle — flip off, verify raw text; flip on, verify formatted```markdown ```— verify content renders as markdown, not code