# Implementation Plan: Markdown Support & Syntax Highlighting

## Phase 1: Markdown Integration & Setup
- [ ] Task: Research and configure `imgui_markdown` within the existing `imgui-bundle` environment.
    - [ ] Identify required font assets for Markdown (bold, italic, headers).
    - [ ] Create a `MarkdownRenderer` wrapper class in `src/markdown_helper.py` to manage styling and callbacks (links, etc.).
- [ ] Task: Implement basic Markdown rendering in a test panel.
    - [ ] Verify that bold, italic, and headers render correctly using the defined theme fonts.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Markdown Integration' (Protocol in workflow.md)

## Phase 2: Syntax Highlighting Implementation
- [ ] Task: Implement syntax highlighting for PowerShell, Python, and JSON/TOML.
    - [ ] Research `imgui-bundle`'s recommended approach for syntax highlighting (e.g., using `ImGuiColorTextEdit` or specialized Markdown callbacks).
    - [ ] Define language-specific color palettes that match the "Professional" theme.
- [ ] Task: Implement the language resolution logic.
    - [ ] Create a utility to extract language tags from code blocks and resolve file extensions.
    - [ ] Implement cheap heuristic for common code patterns (e.g., matching `def `, `if $`, `{ "`).
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Syntax Highlighting' (Protocol in workflow.md)

## Phase 3: GUI Integration (Read-Only Views)
- [ ] Task: Integrate Markdown rendering into the Discussion History.
    - [ ] Replace `imgui.text_wrapped` in `_render_discussion_panel` with the `MarkdownRenderer`.
    - [ ] Ensure that code blocks within AI messages are correctly highlighted.
- [ ] Task: Integrate syntax highlighting into the Comms Log.
    - [ ] Update `_render_comms_history_panel` to render JSON/TOML payloads with highlighting.
- [ ] Task: Integrate syntax highlighting into the Operations/Tooling panels.
    - [ ] Ensure PowerShell scripts and tool results are rendered with highlighting.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: GUI Integration' (Protocol in workflow.md)

## Phase 4: Refinement & Final Polish
- [ ] Task: Refine performance for large logs.
    - [ ] Implement incremental rendering or caching for rendered Markdown blocks to maintain high FPS.
- [ ] Task: Implement clickable links.
    - [ ] Handle link callbacks to open external URLs in the browser or local files in the configured text editor.
- [ ] Task: Conduct a final visual audit across all read-only views.
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Final Polish' (Protocol in workflow.md)
