sphinx-copybutton

Homepage:

https://github.com/executablebooks/sphinx-copybutton

Documentation:

https://sphinx-copybutton.readthedocs.io/en/latest/

sphinx-copybutton adds a small “copy” button at the right of all .. code-block:: directives [1], allowing the reader to copy all its content into the clipboard with just one click.

It has some useful options to customize, like copying only lines that does not contains prompt, among others.

Example

Click in the right icon to copy this text!

Installation

pip install sphinx-copybutton

Configuration

# conf.py
extensions = [
    '...',
    'sphinx_copybutton',
]