sphinx-copybutton
sphinx-copybutton copied to clipboard
Big copybutton the RTD Theme
How can I make the svg image smaller using the CSS? In case of the RTD Theme the button appears huge.

holy moly! that is huge :-) I haven't seen that on the RTD theme before. Do you think you could try using the "master" branch and see if that fixes it? And if so, we can make a new release
Well to add on each code cell that image would enlarge my content of the page drastically ;-)
I've tried the master branch code from https://github.com/choldgraf/sphinx-copybutton/tree/master/sphinx_copybutton
But then no button appears. I've also changed the icon in the conf.py with a smaller one, which helps ,but the location is still wrong.
copybutton_image_path = 'img/copybutton.svg'

Like your css is not taken into consideration. I've also tried adding my own css but this has also no effect:
html_static_path = ['_static']
html_css_files = [
'css/copybutton.css',
]
# or
html_context = {
'cssfiles': ['_static/css/copybutton.css']
}
hmmm - it is strange that no button appears when on master. I just tried out the sphinx_rtd_theme on my local master branch and it worked fine:

I'm not sure how to debug on your side, but you shouldn't need to manually add any extra CSS files yourself...maybe also make sure your Sphinx is updated?
It was my error why the master had no button, I corrected it but got the same error as on the pip install version. In the mean time I also tried building without any extentions without luck. In the end I got it to work with the external css file. herafter my conf.py: https://github.com/tschinz/zawiki/blob/master/source/conf.py Thanks for your help
FYI the RTD theme works fine for me: https://17-145482568-gh.circle-artifacts.com/0/html/intro/get_started.html#quick-installation
The problem comes from extending the css to better handle the table width. There is this issue in the sphinx_rtd_theme repository. I copy the code from a comment fixing the issue, but generating the problem described in this issue:
/* _static/theme_overrides.css */
/* override table width restrictions */
.wy-table-responsive table td, .wy-table-responsive table th {
white-space: normal;
}
.wy-table-responsive {
margin-bottom: 24px;
max-width: 100%;
overflow: visible;
}
# conf.py
html_static_path = ['_static']
html_context = {
'css_files': [
'_static/theme_overrides.css', # overrides for wide tables in RTD theme
],
}
@chrisjsewell The link you posted does not work anymore.
@choldgraf Did you have time to look into this issue based on my comment?
I haven't had time - but I am more than happy to review a PR from somebody that both
- Fixes this in the RTD theme
- Doesn't break this in any other Sphinx theme
👍
I don't know why and what has changed, but this problem no longer happens since
- sphinx_rtd_theme 0.5.0
- sphinx_copybutton 0.3.0
Edit: Just to document, that it really works: custom CSS from the issue I mentioned in https://github.com/executablebooks/sphinx-copybutton/issues/69#issuecomment-652201777: https://github.com/swaldhoer/native-lua/blob/a4d4f83fe16f2248b61d62ef740e6492a33869fd/docs/_static/custom.css and the documentation works fine: https://native-lua.readthedocs.io/en/latest/build.html