Skip to content

Richly render (streamed) markdown, such as from command-line LLMs.

License

Notifications You must be signed in to change notification settings

gianlucatruda/richify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Richify: Markdown Live Renderer

A real-time Markdown rendering tool that supports streaming input. Built with Rich and designed to run with uv.

GIF demo of using richify in terminal

Original inspiration: this comment. For non-streaming use cases, consider using rich-cli instead.

Usage

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.)

How It Works

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.

Installation

  1. First, install uv if you haven't already:

  2. Clone this repository:

git clone https://github.com/gianlucatruda/richify.git
cd richify
  1. Convert richify.py to an executable script:
chmod +x richify.py
  1. (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.

Example of using richify in terminal Example of using richify in terminal

About

Richly render (streamed) markdown, such as from command-line LLMs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages