sphinx-copybutton is a Sphinx extension that adds a 'copy' button to each of your code cells in Sphinx documentation. It is currently at version 0.5.2, actively maintained, and releases generally align with bug fixes, minor enhancements, or updates to stay compatible with Sphinx itself.
pip install sphinx-copybuttonVerified import paths — ran on the pinned version, not inferred.
To enable sphinx-copybutton, first install it using pip. Then, add 'sphinx_copybutton' to the `extensions` list within your Sphinx project's `conf.py` file. You can optionally configure its behavior, for example, by setting `copybutton_prompt_text` to exclude shell prompts from being copied.
Review your `copybutton_prompt_text` configuration. If you were double-escaping backslashes, you now only need a single escape (e.g., `"\\$ "` became `"\$ "`). Refer to the v0.3.0 release notes.
Update any custom CSS targeting the copy button to reflect the new SVG-based structure. You may need to target the `svg` element or its parent container directly. Inspect the generated HTML to identify the correct selectors.
If you use code blocks with `... prompt` directives (which often apply the `.gp` class) and find prompts are now copied, explicitly configure `copybutton_prompt_text` with a regular expression (e.g., `^\$ `) to exclude them, ensuring `copybutton_prompt_is_regexp = True`.