sphinx-copybutton icon indicating copy to clipboard operation
sphinx-copybutton copied to clipboard

Only copy lines with `.gp` class

Open nineteendo opened this issue 1 year ago • 0 comments

Context

I would like to exclude the traceback from being copied:

>>> 1 / 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero

But that's difficult because the class of "division by zero" is .n, and hard coding the prompts is prone to error.

Proposal

If a code block contains .gp, allow to exclude .gp from lines and only copy these lines. >>> becomes an empty line. Or alternatively convert the other lines to empty lines.

Tasks and updates

No response

nineteendo avatar Sep 03 '24 07:09 nineteendo