Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big copybutton the RTD Theme #69

Open
tschinz opened this issue Mar 23, 2020 · 9 comments
Open

Big copybutton the RTD Theme #69

tschinz opened this issue Mar 23, 2020 · 9 comments

Comments

@tschinz
Copy link

tschinz commented Mar 23, 2020

How can I make the svg image smaller using the CSS? In case of the RTD Theme the button appears huge.

20200323_0802_ZELL

@tschinz tschinz changed the title Big copybutton the the RTD Theme Big copybutton the RTD Theme Mar 23, 2020
@choldgraf
Copy link
Member

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

@tschinz
Copy link
Author

tschinz commented Mar 23, 2020

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'

image

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']
}

@choldgraf
Copy link
Member

choldgraf commented Mar 26, 2020

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:

image

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?

@tschinz
Copy link
Author

tschinz commented Mar 27, 2020

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

@chrisjsewell
Copy link
Member

@swaldhoer
Copy link

swaldhoer commented Jul 1, 2020

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.

@swaldhoer
Copy link

@choldgraf Did you have time to look into this issue based on my comment?

@choldgraf
Copy link
Member

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

👍

@swaldhoer
Copy link

swaldhoer commented Sep 6, 2020

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 #69 (comment): 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants