From 57d72efb5406972642be7fb26fdd0d3dd9c51cfd Mon Sep 17 00:00:00 2001 From: Dmitriy Chubinidze Date: Tue, 2 Dec 2025 21:11:11 +0000 Subject: [PATCH] Add the Sphinx copy-button Add the Sphinx copy-button feature to improve usability when copying code blocks and command examples. Depends-On: I8c367e5f78ac15b28190c1d6788971681c58dacd Change-Id: I83e9d0e4135082060f4d12803bb379ab5b981dbc Signed-off-by: Dmitriy Chubinidze --- doc/requirements.txt | 1 + doc/source/conf.py | 6 +++++- doc/source/deploy-guide/source/conf.py | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 0181c1a37d..a3d763c662 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -5,6 +5,7 @@ # this is required for the docs build jobs sphinx>=2.0.0,!=2.1.0 # BSD sphinxcontrib-svg2pdfconverter>=0.1.0 # BSD +sphinx-copybutton>=0.5.2 # MIT openstackdocstheme>=2.2.1 # Apache-2.0 reno>=3.1.0 # Apache-2.0 doc8>=0.8.1 # Apache-2.0 diff --git a/doc/source/conf.py b/doc/source/conf.py index c5894af233..ffdf69ecb6 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -123,9 +123,13 @@ extensions = [ 'openstackdocstheme', 'sphinx.ext.autodoc', 'sphinx.ext.extlinks', - 'sphinxcontrib.rsvgconverter' + 'sphinxcontrib.rsvgconverter', + 'sphinx_copybutton' ] +# Remove the prompt text from lines +copybutton_prompt_text = "# " + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] diff --git a/doc/source/deploy-guide/source/conf.py b/doc/source/deploy-guide/source/conf.py index c5a64e7fcf..f3ea99b4a4 100644 --- a/doc/source/deploy-guide/source/conf.py +++ b/doc/source/deploy-guide/source/conf.py @@ -100,8 +100,11 @@ sys.path.insert(0, os.path.abspath('../../inventory/')) extensions = [ 'openstackdocstheme', 'sphinx.ext.autodoc', - 'sphinx.ext.extlinks' + 'sphinx.ext.extlinks', + 'sphinx_copybutton' ] +# Remove the prompt text from lines +copybutton_prompt_text = "# " # Add any paths that contain templates here, relative to this directory. # templates_path = ['_templates']