Skip to content

Commit 0fccca0

Browse files
authored
Merge pull request #946 from meowmeowmeowcat/copy-button
2 parents c3b6c46 + 31c61f9 commit 0fccca0

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ sphinx==4.0.3
22
sphinx-autobuild==0.7.1
33
sphinx-inline-tabs==2021.4.11b9
44
python-docs-theme==2021.5
5+
sphinx-copybutton==0.4.0
56
git+https://github.com/pypa/pypa-docs-theme.git#egg=pypa-docs-theme

source/_static/overrides.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* Overrides for theme and plugin styles */
2+
3+
/* https://github.com/executablebooks/sphinx-copybutton/blob/v0.4.0/sphinx_copybutton/_static/copybutton.css */
4+
5+
button.copybtn img {
6+
/* Fix alignment for pypa_theme */
7+
padding: 0;
8+
}

source/conf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@
3535
'sphinx.ext.intersphinx',
3636
'sphinx.ext.todo',
3737
'sphinx_inline_tabs',
38+
'sphinx_copybutton',
3839
]
3940

41+
# config for copy button
42+
copybutton_prompt_text = r">>> |\.\.\. |\$ |> "
43+
copybutton_prompt_is_regexp = True
44+
4045
# Add any paths that contain templates here, relative to this directory.
4146
templates_path = ['_templates']
4247

@@ -176,7 +181,9 @@
176181
# Add any paths that contain custom static files (such as style sheets) here,
177182
# relative to this directory. They are copied after the builtin static files,
178183
# so a file named "default.css" will overwrite the builtin "default.css".
179-
# html_static_path = ['_static']
184+
html_static_path = ['_static']
185+
186+
html_css_files = ['overrides.css']
180187

181188
# Add any extra paths that contain custom files (such as robots.txt or
182189
# .htaccess) here, relative to this directory. These files are copied

0 commit comments

Comments
 (0)