sphinxcontrib-programoutput icon indicating copy to clipboard operation
sphinxcontrib-programoutput copied to clipboard

Add Rich-based SVG Rendering for program-output

Open mgaitan opened this issue 11 months ago • 2 comments

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 avatar Mar 06 '25 15:03 mgaitan

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.

jamadden avatar Mar 09 '25 17:03 jamadden

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.

mgaitan avatar Mar 11 '25 02:03 mgaitan

moved to https://github.com/mgaitan/richterm

mgaitan avatar Nov 04 '25 02:11 mgaitan