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!

Copy Button Demo

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.5.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

sphinx_copybutton-0.5.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sphinx-copybutton-0.5.0.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for sphinx-copybutton-0.5.0.tar.gz
Algorithm Hash digest
SHA256 a0c059daadd03c27ba750da534a92a63e7a36a7736dcf684f26ee346199787f6
MD5 223f26b9ba5397e5554075bc540a3b46
BLAKE2b-256 4da7d9fca1553828adfb3496f6436a1c3d624d71cae76d56e569dc722f92cbca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sphinx_copybutton-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for sphinx_copybutton-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9684dec7434bd73f0eea58dda93f9bb879d24bff2d8b187b1f2ec08dfe7b5f48
MD5 10f92aefe3f7cfb739766ee2c546dada
BLAKE2b-256 bb672e45820994078b7d760f2c5ada5fd9c19bc352c010d3fd2aee799fdeffa4

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