Skip to content

Commit 1c464cb

Browse files
authored
Add copy button to documentation (#1124)
* add sphinx_copybutton and config * update release notes * add `sphinx-copybutton` to rtfd reqs
1 parent 50edad8 commit 1c464cb

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

docs/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
'sphinx.ext.intersphinx',
4545
'numpydoc',
4646
'sphinx_issues',
47+
"sphinx_copybutton",
4748
]
4849

4950
numpydoc_show_class_members = False
@@ -312,3 +313,9 @@ def setup(app):
312313
# :ref:`comparison manual <python:comparisons>`
313314
intersphinx_mapping = { 'python':('https://docs.python.org/', None),
314315
'numpy': ('https://numpy.org/doc/stable/', None)}
316+
317+
318+
# sphinx-copybutton configuration
319+
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
320+
copybutton_line_continuation_character = "\\"
321+
copybutton_prompt_is_regexp = True

docs/release.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Documentation
3939
~~~~~~~~~~~~~
4040

4141
* Typo fixes to close quotes. By :user:`Pavithra Eswaramoorthy <pavithraes>`
42+
* Added copy button to documentation :user:`Altay Sansal <tasansal>`
4243

4344
Maintenance
4445
~~~~~~~~~~~

requirements_rtfd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ setuptools
33
setuptools_scm
44
sphinx
55
sphinx-issues
6+
sphinx-copybutton
67
sphinx-rtd-theme
78
numpydoc
89
numpy!=1.21.0

0 commit comments

Comments
 (0)