"""Renderer for markdown content."""

from __future__ import annotations

from rich.console import RenderableType
from rich.markdown import Markdown

from .base import ContentRenderer


class MarkdownRenderer(ContentRenderer):
    """Render markdown text with syntax highlighting."""

    def accepts(self, msg: dict) -> bool:
        return msg.get("type") == "markdown"

    def render(self, msg: dict) -> RenderableType:
        text = msg.get("content", "")
        return Markdown(text, code_theme="monokai")
