Skip to content

gh-107024 Added copy button to code snippets in documentation #107037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'pyspecific',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx_copybutton',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've been cautious about including third-party extensions, in case downstream redistributors haven't installed them. See the try/except block just below for sphinxext.opengraph.

All the others here are Sphinx builtin extensions, or our own custom ones.

]

# Skip if downstream redistributors haven't installed it
Expand Down Expand Up @@ -379,3 +380,5 @@
'<meta property="og:image:height" content="200" />',
'<meta name="theme-color" content="#3776ab" />',
]

copybutton_exclude = '.linenos, .gp, .go'
1 change: 1 addition & 0 deletions Doc/requirements-oldest-sphinx.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
urllib3==1.26.15
sphinx-copybutton<0.6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is meant to be a generated list of pinned dependencies, see instructions at the top.

1 change: 1 addition & 0 deletions Doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ sphinx==6.2.0
blurb

sphinxext-opengraph==0.7.5
sphinx-copybutton<0.6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the upper version limit?


# The theme used by the documentation is stored separately, so we need
# to install that as well.
Expand Down
7 changes: 7 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1057,3 +1057,10 @@ removed, although there is currently no date scheduled for their removal.
* :c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get`.
* :c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete`.
* :c:func:`PyThread_ReInitTLS`: no longer needed.


Documentation
=============

* :gh:`107024` -- added ``sphinx-copybutton`` to docs dependencies. Now one can copy contents of ``code-block`` with
just a click of a button.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added copy button to code snippets in documentation