@@ -11,7 +11,9 @@ Sphinx-copybutton
1111 :alt: PyPi page
1212
1313Sphinx-copybutton does one thing: add little "copy" button to the right
14- of your code blocks. That's it!
14+ of your code blocks. That's it! It is a lightweight wrapper around the
15+ excellent (and also lightweight) Javascript library
16+ `ClipboardJS <https://clipboardjs.com/> `.
1517
1618**Here's an example **
1719
@@ -24,6 +26,18 @@ And here's a code block, note the copy button to the right!
2426
2527 copy me!
2628
29+ By default, ``sphinx-copybutton `` will remove Python prompts from
30+ each line that begins with them. For example, try copying the text
31+ below:
32+
33+ .. code-block :: python
34+
35+ >> > a = 2
36+ >> > print (a)
37+
38+ The text that ``sphinx-copybutton `` uses can be configured as well. See
39+ :ref: `configure_copy_text ` for more information.
40+
2741If the code block overlaps to the right of the text area, you can just click
2842the button to get the whole thing.
2943
@@ -73,9 +87,24 @@ Customize the CSS
7387To customize the display of the copy button, you can add your own CSS files
7488that overwrite the CSS in the
7589`sphinx-copybutton CSS rules <https://github.com/choldgraf/sphinx-copybutton/blob/master/_static/copybutton.css >`_.
76- Just add these files to `_static ` in your documentation folder, and it should
90+ Just add these files to `` _static ` ` in your documentation folder, and it should
7791overwrite sphinx-copybutton's behavior.
7892
93+ .. _configure_copy_text :
94+
95+ Customize the text that is removed during copying
96+ -------------------------------------------------
97+
98+ By default, ``sphinx-copybutton `` will remove Python prompts (">>> ") from
99+ the beginning of each line. To change the text that is removed (or to remove
100+ no text at all), add the following configuration to your ``conf.py `` file:
101+
102+ .. code :: python
103+
104+ copybutton_skip_text = " sometexttoskip"
105+
106+ Note that this text will only be removed from lines that *begin * with the text.
107+
79108Use a different copy button image
80109---------------------------------
81110
0 commit comments