Markdown Rendering in Textual CLI

The --tui CLI mode now supports markdown rendering for agent responses! This makes the output much more readable and visually appealing.

Features

Headers

  • # Header 1 β†’ πŸ”· Header 1
  • ## Header 2 β†’ πŸ”Έ Header 2
  • ### Header 3 β†’ β–ͺ️ Header 3

Text Formatting

  • **bold text** β†’ [bold text]
  • *italic text* β†’ (italic text)
  • __bold text__ β†’ [bold text]
  • _italic text_ β†’ (italic text)

Code

  • `inline code` β†’ inline code
  • Code blocks with syntax highlighting:
    def hello():
      print("Hello, World!")
    

    β†’ πŸ’» Code: def hello(): print(β€œHello, World!”)

Lists

  • - Item 1 β†’ β€’ Item 1
  • * Item 2 β†’ β€’ Item 2
  • + Item 3 β†’ β€’ Item 3
  • 1. Numbered β†’ 1️⃣ Numbered

Other Elements

  • > Blockquote β†’ πŸ’¬ Blockquote
  • [Link](https://example.com) β†’ Link (https://example.com)
  • --- β†’ ──────────────────────────────────────────────────

Usage

Toggle Markdown Rendering

  • Ctrl+M - Toggle markdown rendering on/off
  • Status bar shows πŸ“ when enabled, πŸ“„ when disabled
  • Enabled by default

Example Agent Response

When an agent responds with markdown like:

# Analysis Results

## Summary
The code analysis found **3 issues**:

1. Missing error handling
2. Unused variables
3. Performance bottleneck

### Recommendations
- Add `try/catch` blocks
- Remove unused code
- Optimize the `process_data()` function

> **Note**: These are suggestions, not requirements.

It will be rendered as:

πŸ”· Analysis Results

πŸ”Έ Summary
The code analysis found [3 issues]:

1️⃣ Missing error handling
2️⃣ Unused variables  
3️⃣ Performance bottleneck

β–ͺ️ Recommendations
β€’ Add `try/catch` blocks
β€’ Remove unused code
β€’ Optimize the `process_data()` function

πŸ’¬ [Note]: These are suggestions, not requirements.

Benefits

βœ… Better readability - Structured content with visual hierarchy
βœ… Emoji indicators - Quick visual scanning of content types
βœ… Terminal-friendly - Works well in any terminal environment
βœ… Toggle-able - Can be disabled if plain text is preferred
βœ… Preserves functionality - All CLI features still work normally

Keyboard Shortcuts

Shortcut Action
Ctrl+M Toggle markdown rendering
Ctrl+T Toggle theme (dark/light)
Ctrl+C Interrupt agent
Ctrl+L Clear output
Ctrl+D Exit

The markdown rendering makes agent responses much more pleasant to read while maintaining the powerful Textual CLI functionality!