Skip to main content

Add a copy button to each of your code cells.

Project description

sphinx-copybutton

PyPI | Conda Version | Documentation

A small sphinx extension to add a "copy" button to code blocks.

See the sphinx-copybutton documentation for more details!

Installation

You can install sphinx-copybutton with pip:

pip install sphinx-copybutton

Or with conda via conda-forge:

conda install -c conda-forge sphinx-copybutton

Usage

In your conf.py configuration file, add sphinx_copybutton to your extensions list. E.g.:

extensions = [
    ...
    'sphinx_copybutton'
    ...
]

When you build your site, your code blocks should now have little copy buttons to their right. Clicking the button will copy the code inside!

Customization

If you'd like to customize the look of the copy buttons, you can over-write any of the CSS rules specified in the Sphinx-CopyButton CSS file (link)

Development

Development should principally adhere to the EBP Developer Conventions

Sphinx-Copybutton is hosted on the pypi repository. After a release - following the EBP release instructions - confirm that the new version of Sphinx-Copybutton is posted to pypi.

Acknowledgements

Many thanks to the excellent clipboard.js library for the lightweight javascript code that powers the copy button!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx-copybutton-0.4.0.tar.gz (594.6 kB view details)

Uploaded Source

Built Distribution

sphinx_copybutton-0.4.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file sphinx-copybutton-0.4.0.tar.gz.

File metadata

  • Download URL: sphinx-copybutton-0.4.0.tar.gz
  • Upload date:
  • Size: 594.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for sphinx-copybutton-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8daed13a87afd5013c3a9af3575cc4d5bec052075ccd3db243f895c07a689386
MD5 e7c8bd6e2a59e696b864281ff82f7194
BLAKE2b-256 d079d57ca42f4be2ac21f660300a5e1a285ce42b23c45b5a4b9a21ce973a3b2f

See more details on using hashes here.

File details

Details for the file sphinx_copybutton-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: sphinx_copybutton-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for sphinx_copybutton-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4340d33c169dac6dd82dce2c83333412aa786a42dd01a81a8decac3b130dc8b0
MD5 33d2764b80ce29f1410ad90edd62801d
BLAKE2b-256 818b7c9cf5956be80bfd826f2534e2b38ff2310f8c4274a77e4b3b2d846af552

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page