Skip to content

Commit 86ebb08

Browse files
authored
Merge pull request numpy#26980 from mosc9575/26948_add_sphinx_copybutton
add sphinx-copybutton
2 parents d489c83 + 4f68bdd commit 86ebb08

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

doc/source/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class PyTypeObject(ctypes.Structure):
8787
'IPython.sphinxext.ipython_console_highlighting',
8888
'IPython.sphinxext.ipython_directive',
8989
'sphinx.ext.mathjax',
90+
'sphinx_copybutton',
9091
'sphinx_design',
9192
]
9293

@@ -285,6 +286,9 @@ def setup(app):
285286
plot_html_show_formats = False
286287
plot_html_show_source_link = False
287288

289+
# sphinx-copybutton configurations
290+
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
291+
copybutton_prompt_is_regexp = True
288292
# -----------------------------------------------------------------------------
289293
# LaTeX output
290294
# -----------------------------------------------------------------------------

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dependencies:
2929
- mypy=1.10.0
3030
# For building docs
3131
- sphinx>=4.5.0
32+
- sphinx-copybutton
3233
- sphinx-design
3334
- numpydoc=1.4.0
3435
- ipython

requirements/doc_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
sphinx==7.2.6
33
numpydoc==1.4
44
pydata-sphinx-theme>=0.15.2
5+
sphinx-copybutton
56
sphinx-design
67
scipy
78
matplotlib

0 commit comments

Comments
 (0)