From 29a4d9361f23bf112704eeeda99eb9ba1047164e Mon Sep 17 00:00:00 2001 From: Nikita Churikov Date: Sat, 22 Jul 2023 16:10:24 +0200 Subject: [PATCH 1/5] Added copy button as a demo, needs more work. Overwrites >>> toggle button --- Doc/conf.py | 3 +++ Doc/constraints.txt | 1 + 2 files changed, 4 insertions(+) diff --git a/Doc/conf.py b/Doc/conf.py index 09e12e245891d2..4adb1971b0f382 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -22,6 +22,7 @@ 'pyspecific', 'sphinx.ext.coverage', 'sphinx.ext.doctest', + 'sphinx_copybutton', ] # Skip if downstream redistributors haven't installed it @@ -327,3 +328,5 @@ '', '', ] + + diff --git a/Doc/constraints.txt b/Doc/constraints.txt index 54888eaab242ee..8f0e9230eb7278 100644 --- a/Doc/constraints.txt +++ b/Doc/constraints.txt @@ -20,6 +20,7 @@ sphinxcontrib-htmlhelp<2.1 sphinxcontrib-jsmath<1.1 sphinxcontrib-qthelp<1.1 sphinxcontrib-serializinghtml<1.2 +sphinx-copybutton<0.6 # Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above) MarkupSafe<2.2 From 46e9b67fa3ace2306d918b6d19227e66fd0f71a6 Mon Sep 17 00:00:00 2001 From: Nikita Churikov Date: Sat, 22 Jul 2023 23:04:20 +0200 Subject: [PATCH 2/5] excluded from copy code output and repl signs --- Doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/conf.py b/Doc/conf.py index 4adb1971b0f382..0b56cd1576a889 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -329,4 +329,4 @@ '', ] - +copybutton_exclude = '.linenos, .gp, .go' From 8ddef134c36130d592f920d59ea240d6e44d325e Mon Sep 17 00:00:00 2001 From: Nikita Churikov Date: Sat, 22 Jul 2023 23:15:58 +0200 Subject: [PATCH 3/5] added news --- Doc/whatsnew/3.13.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index a778e12aba1bce..bd014812032d0d 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -1051,3 +1051,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. From 0e3e817d975c0d6ab4dc23ed0863d77e3263605c Mon Sep 17 00:00:00 2001 From: Nikita Churikov Date: Sat, 22 Jul 2023 23:43:38 +0200 Subject: [PATCH 4/5] fix dependencies --- Doc/constraints.txt | 1 - Doc/requirements.txt | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/constraints.txt b/Doc/constraints.txt index 8f0e9230eb7278..54888eaab242ee 100644 --- a/Doc/constraints.txt +++ b/Doc/constraints.txt @@ -20,7 +20,6 @@ sphinxcontrib-htmlhelp<2.1 sphinxcontrib-jsmath<1.1 sphinxcontrib-qthelp<1.1 sphinxcontrib-serializinghtml<1.2 -sphinx-copybutton<0.6 # Direct dependencies of Jinja2 (Jinja is a dependency of Sphinx, see above) MarkupSafe<2.2 diff --git a/Doc/requirements.txt b/Doc/requirements.txt index bde509febf5bde..9aa4c952c456d5 100644 --- a/Doc/requirements.txt +++ b/Doc/requirements.txt @@ -12,6 +12,7 @@ sphinx==6.2.0 blurb sphinxext-opengraph==0.7.5 +sphinx-copybutton<0.6 # The theme used by the documentation is stored separately, so we need # to install that as well. From 048320e27ef6f5d5d2692b811330eeedb57d59aa Mon Sep 17 00:00:00 2001 From: Nikita Churikov Date: Sun, 23 Jul 2023 13:15:40 +0200 Subject: [PATCH 5/5] added sphinx-copybutton to oldest requirements for sphinx docs; added news with blurb --- Doc/requirements-oldest-sphinx.txt | 1 + .../Documentation/2023-07-23-13-13-52.gh-issue-107024.6KKp9L.rst | 1 + 2 files changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Documentation/2023-07-23-13-13-52.gh-issue-107024.6KKp9L.rst diff --git a/Doc/requirements-oldest-sphinx.txt b/Doc/requirements-oldest-sphinx.txt index f7e0665bde445d..304fd9201da244 100644 --- a/Doc/requirements-oldest-sphinx.txt +++ b/Doc/requirements-oldest-sphinx.txt @@ -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 diff --git a/Misc/NEWS.d/next/Documentation/2023-07-23-13-13-52.gh-issue-107024.6KKp9L.rst b/Misc/NEWS.d/next/Documentation/2023-07-23-13-13-52.gh-issue-107024.6KKp9L.rst new file mode 100644 index 00000000000000..6333f079249b4b --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2023-07-23-13-13-52.gh-issue-107024.6KKp9L.rst @@ -0,0 +1 @@ +Added copy button to code snippets in documentation