From fbfeffff3b3adfd5f767f99d9d4495a4eb7bf523 Mon Sep 17 00:00:00 2001 From: Moritz Schreiber <68053396+mosc9575@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:16:22 +0200 Subject: [PATCH] add sphinx-toggleprompt --- doc/source/_static/css/pandas.css | 5 +++++ doc/source/conf.py | 6 +++--- environment.yml | 1 + requirements-dev.txt | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/source/_static/css/pandas.css b/doc/source/_static/css/pandas.css index 1145177898737..ff5d8ee3d9442 100644 --- a/doc/source/_static/css/pandas.css +++ b/doc/source/_static/css/pandas.css @@ -50,3 +50,8 @@ table { .card, .card img { background-color: var(--pst-color-background); } + +/* Override some aspects of the sphinx-copybutton */ +button.copybtn { + opacity: 1; +} \ No newline at end of file diff --git a/doc/source/conf.py b/doc/source/conf.py index 329ebfb3bd89f..59d62c1ab11fa 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -58,6 +58,7 @@ "numpydoc", "sphinx_copybutton", "sphinx_design", + "sphinx_toggleprompt", "sphinx.ext.autodoc", "sphinx.ext.autosummary", "sphinx.ext.coverage", @@ -71,9 +72,8 @@ "nbsphinx", ] -# sphinx-copybutton configurations -copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.{3,}: | {5,8}: " -copybutton_prompt_is_regexp = True +# sphinx-toggleprompt configurations +toggleprompt_offset_right = 35 exclude_patterns = [ "**.ipynb_checkpoints", diff --git a/environment.yml b/environment.yml index e5646af07c45c..43d8fb6788155 100644 --- a/environment.yml +++ b/environment.yml @@ -92,6 +92,7 @@ dependencies: - sphinx - sphinx-design - sphinx-copybutton + - sphinx-toggleprompt - types-python-dateutil - types-PyMySQL - types-pytz diff --git a/requirements-dev.txt b/requirements-dev.txt index dbfd7c6bf7bf5..730ea2a3309e3 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -67,6 +67,7 @@ pytest-cython sphinx sphinx-design sphinx-copybutton +sphinx-toggleprompt types-python-dateutil types-PyMySQL types-pytz