File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 94
94
togglebutton_hint = str (_ ("Click to expand" ))
95
95
togglebutton_hint_hide = str (_ ("Click to collapse" ))
96
96
97
+ # -- Sphinx-copybutton options ---------------------------------------------
98
+ # Exclude copy button from appearing over notebook cell numbers by using :not()
99
+ # The default copybutton selector is `div.highlight pre`
100
+ # https://github.com/executablebooks/sphinx-copybutton/blob/master/sphinx_copybutton/__init__.py#L82
101
+ copybutton_selector = ":not(.prompt) > div.highlight pre"
97
102
98
103
# -- Options for HTML output -------------------------------------------------
99
104
Original file line number Diff line number Diff line change @@ -263,6 +263,17 @@ You can see it in action by hovering over the code cell below:
263
263
264
264
print (" A copybutton in the top-right!" )
265
265
266
+ .. admonition :: nbsphinx
267
+
268
+ If your documentation site uses both nbsphinx and Sphinx-copybutton, you
269
+ will want to add the following line to your ``conf.py `` file to prevent the
270
+ copy button from appearing on top of notebook cell numbers:
271
+
272
+ .. code-block :: python
273
+ :caption: conf.py
274
+
275
+ copybutton_selector = " :not(.prompt) > div.highlight pre"
276
+
266
277
Toggle buttons
267
278
==============
268
279
You can’t perform that action at this time.
0 commit comments