Skip to content

Commit 8133d8e

Browse files
authored
Merge pull request #62 from choldgraf/docs
documentation improvements for copying functionality
2 parents 92b3b19 + 8db1410 commit 8133d8e

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

doc/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@
9898
# html_sidebars = {}
9999

100100
# CopyButton configuration
101-
# copybutton_prompt_text = ">>> "
101+
copybutton_prompt_text = ">>> "
102+
# Switches for testing but shouldn't be activated in the live docs
102103
# copybutton_only_copy_prompt_lines = False
103104
# copybutton_remove_prompts = False
104105
# copybutton_image_path = "test/TEST_COPYBUTTON.png"

doc/index.rst

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,20 @@ And here's a code block, note the copy button to the right!
2626
2727
copy me!
2828
29-
By default, ``sphinx-copybutton`` will remove Python prompts from
30-
each line that begins with them. If it finds lines that start with the
31-
prompt text, all *other* lines will not be copied.
32-
For example, try copying the text
33-
below:
29+
30+
If the code block overlaps to the right of the text area, you can just click
31+
the button to get the whole thing.
32+
33+
.. code-block:: bash
34+
35+
123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789
36+
37+
You can configure ``sphinx-copybutton`` to detect *input prompts* in code
38+
cells, and then both remove these prompts before copying, as well as skip
39+
lines that *don't* start with prompts (in case they are output lines).
40+
41+
For example, this site has been configured to strip Python prompts (">>> ").
42+
Try copy-pasting the code block below.
3443

3544
.. code-block:: python
3645
@@ -42,16 +51,6 @@ below:
4251
>>> print(b)
4352
wow
4453
45-
The text that ``sphinx-copybutton`` uses can be configured as well. See
46-
:ref:`configure_copy_text` for more information.
47-
48-
If the code block overlaps to the right of the text area, you can just click
49-
the button to get the whole thing.
50-
51-
.. code-block:: bash
52-
53-
123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789
54-
5554
Installation
5655
============
5756

0 commit comments

Comments
 (0)