Skip to content

Add Rich-based SVG Rendering for program-output #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mgaitan
Copy link

@mgaitan mgaitan commented Mar 6, 2025

This PR introduces the ability to render program output using Rich in an SVG format. When Rich mode is active, the output is styled with colors and formatting, resulting in a nicer visual appearance compared to a standard literal block.

How It Works

  • Global Enable: Set programoutput_force_rich = True in your conf.py to force Rich for all directives.
  • Per Directive: Use the :rich: option on a .. program-output:: directive.
  • Width and Colors: Rich respects environment variables like COLUMNS (to set the console width) and FORCE_COLOR (to force ANSI colors).

Example Usage

.. command-output:: python -m rich
   :rich:

image

PS: in addition I upgraded pyproject.toml and removed setup.py

@mgaitan mgaitan marked this pull request as draft March 6, 2025 15:13
@mgaitan mgaitan changed the title wip Add Rich-based SVG Rendering for program-output Mar 6, 2025
@mgaitan mgaitan marked this pull request as ready for review March 6, 2025 19:45
@jamadden
Copy link
Member

jamadden commented Mar 9, 2025

I can't review this PR as is, it contains many unnecessary changes (removal of setup.py, formatting and commenting changes, etc, etc, etc). Please provide a PR with only the necessary changes.

@mgaitan
Copy link
Author

mgaitan commented Mar 11, 2025

I apologize for the messy implementation. I truly believe that every change adds value. Ideally, I would have separated these into different pull requests, but I simply don't have the time right now.

I completely understand if you decide not to merge this, but perhaps others might find the feature useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants