From 94bfb28b5c19465a979385d888d400df7bbfd574 Mon Sep 17 00:00:00 2001 From: Moritz Schreiber <68053396+mosc9575@users.noreply.github.com> Date: Wed, 31 Jul 2024 14:56:42 +0200 Subject: [PATCH 1/3] add sphinx-copybutton configurations to exclude prompts --- doc/source/conf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index 77dd5d03d311c..329ebfb3bd89f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -71,6 +71,10 @@ "nbsphinx", ] +# sphinx-copybutton configurations +copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.{3,}: | {5,8}: " +copybutton_prompt_is_regexp = True + exclude_patterns = [ "**.ipynb_checkpoints", # to ensure that include files (partial pages) aren't built, exclude them 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 2/3] 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 From 2f0fdf1202f6fb639e53ee5dbb30828e6f70a083 Mon Sep 17 00:00:00 2001 From: Moritz Schreiber <68053396+mosc9575@users.noreply.github.com> Date: Wed, 7 Aug 2024 18:23:20 +0200 Subject: [PATCH 3/3] Update pandas.css --- doc/source/_static/css/pandas.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/_static/css/pandas.css b/doc/source/_static/css/pandas.css index ff5d8ee3d9442..8b3fa7734f11e 100644 --- a/doc/source/_static/css/pandas.css +++ b/doc/source/_static/css/pandas.css @@ -54,4 +54,4 @@ table { /* Override some aspects of the sphinx-copybutton */ button.copybtn { opacity: 1; -} \ No newline at end of file +}