diff --git a/aider/mdstream.py b/aider/mdstream.py index 53771c8cb..131f732a1 100755 --- a/aider/mdstream.py +++ b/aider/mdstream.py @@ -3,9 +3,11 @@ import io import time +from rich import box from rich.console import Console from rich.live import Live from rich.markdown import CodeBlock, Heading, Markdown +from rich.panel import Panel from rich.syntax import Syntax from rich.text import Text @@ -62,7 +64,18 @@ class LeftHeading(Heading): def __rich_console__(self, console, options): text = self.text text.justify = "left" # Override justification - yield text + if self.tag == "h1": + # Draw a border around h1s, but keep text left-aligned + yield Panel( + text, + box=box.HEAVY, + style="markdown.h1.border", + ) + else: + # Styled text for h2 and beyond + if self.tag == "h2": + yield Text("") # Keep the blank line before h2 + yield text class NoInsetMarkdown(Markdown):