From: Antonin Godard <antonin.godard@bootlin.com>
To: docs@lists.yoctoproject.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Quentin Schulz <quentin.schulz@cherry.de>,
Antonin Godard <antonin.godard@bootlin.com>
Subject: [PATCH v2] Add the sphinx-copybutton extension
Date: Fri, 19 Dec 2025 10:24:09 +0100 [thread overview]
Message-ID: <20251219-sphinx-copybutton-v2-1-e6688f8d9167@bootlin.com> (raw)
This extension adds a copy button to code-blocks.
It was added to the buildtools tarballs for documentation with
commit ebf14a6dc1a5 ("python3-sphinx-copybutton: add recipe") in
OE-Core, so the the Autobuilder can use it.
Add it as a requirement in the docs, including in Ubuntu requirements.
According to https://pkgs.org/download/python3-sphinx-copybutton this
packages is provided under "python3-sphinx-copybutton" on all the
versions of Ubuntu we support.
Suggested-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
Changes in v2:
- Suggested by Quentin: set copybutton_prompt_text to "$ " in
conf.py so dollar signs at line beginnings are not copied.
- Link to v1: https://patch.msgid.link/20251218-sphinx-copybutton-v1-1-752b7c4ff8f9@bootlin.com
---
documentation/Pipfile | 1 +
documentation/conf.py | 4 ++++
documentation/tools/host_packages_scripts/pip3_docs.sh | 2 +-
documentation/tools/host_packages_scripts/ubuntu_docs.sh | 2 +-
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/documentation/Pipfile b/documentation/Pipfile
index 7ee1d22905..1fa2df31e7 100644
--- a/documentation/Pipfile
+++ b/documentation/Pipfile
@@ -9,6 +9,7 @@ verify_ssl = true
sphinx = "*"
sphinx-rtd-theme = "*"
pyyaml = "*"
+sphinx-copybutton = "*"
[requires]
python_version = "3"
diff --git a/documentation/conf.py b/documentation/conf.py
index c07b6c4199..3d04f90572 100644
--- a/documentation/conf.py
+++ b/documentation/conf.py
@@ -66,6 +66,7 @@ extensions = [
'sphinx.ext.autosectionlabel',
'sphinx.ext.extlinks',
'sphinx.ext.intersphinx',
+ 'sphinx_copybutton',
'yocto-vars'
]
autosectionlabel_prefix_document = True
@@ -123,6 +124,9 @@ intersphinx_mapping = {
# Suppress "WARNING: unknown mimetype for ..."
suppress_warnings = ['epub.unknown_project_files']
+# sphinx-copybutton configuration
+copybutton_prompt_text = "$ "
+
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
diff --git a/documentation/tools/host_packages_scripts/pip3_docs.sh b/documentation/tools/host_packages_scripts/pip3_docs.sh
index fd6ad98053..907ecec55c 100644
--- a/documentation/tools/host_packages_scripts/pip3_docs.sh
+++ b/documentation/tools/host_packages_scripts/pip3_docs.sh
@@ -1 +1 @@
-sudo pip3 install sphinx sphinx_rtd_theme pyyaml
+sudo pip3 install sphinx sphinx_rtd_theme pyyaml sphinx-copybutton
diff --git a/documentation/tools/host_packages_scripts/ubuntu_docs.sh b/documentation/tools/host_packages_scripts/ubuntu_docs.sh
index 67bb810946..c322b61e42 100644
--- a/documentation/tools/host_packages_scripts/ubuntu_docs.sh
+++ b/documentation/tools/host_packages_scripts/ubuntu_docs.sh
@@ -1 +1 @@
-sudo apt install git librsvg2-bin locales make python3-saneyaml python3-sphinx-rtd-theme sphinx
+sudo apt install git librsvg2-bin locales make python3-saneyaml python3-sphinx-rtd-theme python3-sphinx-copybutton sphinx
---
base-commit: d84d916d4fc505e8386693306b6a90b0064c0518
change-id: 20251217-sphinx-copybutton-40e213333b4a
next reply other threads:[~2025-12-19 9:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 9:24 Antonin Godard [this message]
2026-01-05 13:52 ` [PATCH v2] Add the sphinx-copybutton extension Antonin Godard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251219-sphinx-copybutton-v2-1-e6688f8d9167@bootlin.com \
--to=antonin.godard@bootlin.com \
--cc=docs@lists.yoctoproject.org \
--cc=quentin.schulz@cherry.de \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox