Skip to content

Commit 30cdb3f

Browse files
authored
ENH - When using the copybutton in code blocks, exclude copying the prompt (#2036)
When I use the copybutton in code blocks, I expect to be able to paste the code into my terminal without having to delete the prompt that gets copied. This PR fixes that issue by excluding CSS classes that Pygments generates in code blocks. See https://sphinx-copybutton.readthedocs.io/en/latest/use.html#automatic-exclusion-of-prompts-from-the-copies
1 parent 08f2b78 commit 30cdb3f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
# Exclude copy button from appearing over notebook cell numbers by using :not()
114114
# The default copybutton selector is `div.highlight pre`
115115
# https://github.com/executablebooks/sphinx-copybutton/blob/master/sphinx_copybutton/__init__.py#L82
116+
copybutton_exclude = ".linenos, .gp"
116117
copybutton_selector = ":not(.prompt) > div.highlight pre"
117118

118119
# -- Options for HTML output -------------------------------------------------

0 commit comments

Comments
 (0)