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