Skip to main content

rich-codex ⚡️📖⚡️

A GitHub Action / command-line tool which generates screengrab images of a terminal window, containing command outputs or code snippets.

📚 Documentation: https://ewels.github.io/rich-codex/ 📚

PyPI Version

Introduction

Having code examples in your documentation is a fantastic way to help users understand what to expect from your tool.

Using terminal screenshots is a good way to do this because:

  • 🌈 Coloured terminal output is supported
  • ↔️ You can fit in long lines without scrolling or cropping (images are auto-resized)
  • 😎 They look cool

However, manually generating these screenshots is a pain 👎🏻 Remembering to update them every time you make a minor change means that they can easily get out of date.

Rich-codex automates this process for you. It searches markdown code for images with shell commands or code snippets. It runs these commands and saves a terminal screen-grab at the embedded path.

Typical use cases:

  • 📷 Example CLI tool outputs that automatically stay in sync with your package
  • ♻️ Syntax-highlighted code snippets that are always up to date with your examples/
  • 🤩 Fast and simple images for your docs with minimal setup

Quickstart

  1. 📖 Write some markdown docs, use an image tag with a backtick command inside:

    ![`cat docs/cat.txt | lolcat -S 1`](docs/img/cat.png)
    
  2. 🤖 Add a GitHub Action to automatically run the command, generate the image and commit to the repo:

    on: [push]
    jobs:
      rich_codex:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v3
    
          - name: Install your custom tools
            run: pip install lolcat
    
          - name: Generate terminal images with rich-codex
            uses: ewels/rich-codex@v1
            with:
              commit_changes: "true"
    
  3. 🌈 Enjoy reading your documentation My cat rainbow

How it works

Rich-codex is a command-line tool that you can run via a GitHub action or as a command line tool. It works with any markdown (including GitHub READMEs).

It collects either commands or code snippets, together with output filenames and configuration options. Commands are run in a subprocess and the standard output & standard error collected. These are then rendered as an image using Textualize/rich.

Rich-codex creates the images that your markdown docs expect. It doesn't require a HTML build-step and doesn't make any changes to your markdown, unless you ask it to write command output into a code block. As such, it's compatible with any documentation engine, including rendering markdown on github.com.

Rich-codex needs inputs (commands / snippets) and output filenames to work. These can be configured in five different ways:

  • 🖼 Markdown images
    • Search markdown files for image tags with command alt text. eg: ![`rich-codex --help`](docs/img/rich-codex-help.svg)
  • 💬 Markdown comments
    • Search markdown files for special HTML / JSX comments.
  • 📝 Markdown code blocks
    • Run the command in a code block and save its output as text, to a file or into the code block.
  • ➡️ Command-line / action inputs
    • Specify a command or snippet using the action with inputs.
  • ⚙️ Config files
    • Use one or more YAML config files for multiple images and more complex customisation.

Images can be generated as SVG or PNG, or the output saved as text with ANSI colour codes in an .ansi file (detected by filename extension).

Keep reading! 👉 https://ewels.github.io/rich-codex/

Metadata

Release files for rich-codex 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rich-codex 1.5.0
File Size Uploaded Provenance Actions
rich_codex-1.5.0.tar.gz 3.4 MB With provenance Details for rich_codex-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rich-codex 1.5.0
File Interpreter ABI Platform Actions
rich_codex-1.5.0-py3-none-any.whl Python 3 none any Details for rich_codex-1.5.0-py3-none-any.whl

Total release size: 6.8 MB

Release files / rich_codex-1.5.0.tar.gz

Download URL rich_codex-1.5.0.tar.gz
Size 3.4 MB
Tags Source
SHA-256 checksum
How to use checksums
1c92f3e79ccbc4b8e91cf133b7927693def9bff3c66bee0f4afb885bcf66ec64
BLAKE2b-256 checksum
How to use checksums
5e216c346ddefbf1199a5665d88bb5b6e7a78c44c30dc934fcc2619f52e3700e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / rich_codex-1.5.0-py3-none-any.whl

Download URL rich_codex-1.5.0-py3-none-any.whl
Size 3.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a88e4ee823fae7443f552a5e0f152da11e33f22cf68078a2841dc5f75296bd71
BLAKE2b-256 checksum
How to use checksums
d00207d241d8ae70db0835c7d4187f083ba200da1c12d0905a3abf0984637dc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for rich-codex 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rich_codex-1.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page