A real-time Markdown rendering tool that supports streaming input. Built with Rich and designed to run with uv.
Original inspiration: this comment. For non-streaming use cases, consider using rich-cli instead.
Run the script directly with uv:
# Show help
./richify.py
# Pipe content
echo "# Hello" | ./richify.py
# Render a file
cat README.md | ./richify.py
Stream LLM response (the original use case):
llm "Write some markdown with code snippets" | ./richify.py
(Note: Several attempts have been made by myself and others to incorporate this much-requested functionality directly into Simon's LLM tool, but he never reviews or acknowledges the PRs, so we made a workaround.)
- Rich markdown formatting (including streaming) in any mode with --rich by gianlucatruda · Pull Request #571
- rich printing by juftin · Pull Request #278
- Markdown renderer support · Issue #12
The script uses uv's script runner mode and automatically handles dependencies. No separate installation step is needed!
The script automatically:
- Detects if it's receiving piped input
- Shows help text when run without input
- Handles Unicode and encoding errors
- Maintains consistent markdown styling
Richify uses several key components to render Markdown in real-time:
- Rich: For beautiful terminal formatting and Markdown rendering
- Live Display: Updates the rendered content in real-time as new text arrives
- Signal Handling: Gracefully handles Ctrl+C and termination signals
- Streaming Input: Processes input character-by-character for smooth updates
The script automatically manages its dependencies through uv using the script header.
-
First, install uv if you haven't already:
-
Clone this repository:
git clone https://github.com/gianlucatruda/richify.git
cd richify
- Convert
richify.py
to an executable script:
chmod +x richify.py
- (Optional) Move the executable to somewhere in your
PATH
:
For example on macOS
sudo cp richify.py /usr/local/bin/
Now you can invoke it with richify.py
from anywhere.