Skip to content

Commit bac47a2

Browse files
authored
Add sphinx copybutton extension (#865)
* Add sphinx copybutton extension * turn off copybutton for diff
1 parent cd3e0be commit bac47a2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ install_requires =
5252
hieroglyph>=2.1.0
5353
setuptools>=50
5454
sphinx>=7.1, !=7.4.4
55+
sphinx-copybutton
5556
sphinx-design>=0.5.0
5657
sphinx_rtd_theme>=1.0.0
5758
sphinxcontrib-svg2pdfconverter

src/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def generate_task_icon_modifier_rst():
5757
sys.path.append(os.path.abspath('ext')) # path to custom extensions.
5858
extensions = [
5959
# sphinx built-in extensions
60+
'sphinx_copybutton',
6061
'sphinx.ext.autodoc',
6162
'sphinx.ext.autosummary',
6263
'sphinx.ext.graphviz',
@@ -332,3 +333,6 @@ def generate_task_icon_modifier_rst():
332333
# Create sentence case versions of wordlist:
333334
sentence_case = [word.capitalize() for word in words]
334335
sentence_case_file.write_text('\n'.join(sentence_case) + '\n')
336+
337+
# Turn off copybutton for diffs
338+
copybutton_selector = "div:not(.highlight-diff) > div.highlight > pre"

0 commit comments

Comments
 (0)