Fix problems with some themes#54
Conversation
theme css rules applied on 'img' tags (themes: astropy-theme, py3doc-enhanced-theme, typlog-theme)
caused copy function to break (themes: julia-theme, pytorch-theme)
red line inside the icon with typlog-theme
theme: itcase-theme after js and css inclusion in the template is fixed
warning in the console, explaining what went wrong and how to fix it
|
This all seems reasonable to me - thanks very much for double-checking the behavior of SCB on multiple themes! If you think there's a good place in the docs to mention this, I'd be happy to merge a PR that adds this in somewhere. Let me know if you'd like that to be in this PR or another As an aside, have you published a circle configuration that demonstrates behavior across a number of themes anywhere? I'd love to implement this in sphinx-copybutton and feel like it'd be helpful for other developers as well! |
|
Mentioning the problematic themes in the docs might be a good idea, but I think someone should also create issues (or even PRs) in the repos of the affected themes. |
|
it sounds like the docs change is best in a different PR, thanks very much for the improvement @s-weigand ! |
This fixes some issues with some specific themes (see).
Some problems are a result of css rules being overwritten by theme rules (astropy-theme, py3doc-enhanced-theme, typlog-theme), others are a result of an old way (julia-theme, pytorch-theme, itcase-theme, pyviz-theme) to include additional javascript files in a theme.
Details concerning javascript issues
The old way to include javascript files (
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>) does not support a missing file name so the browser tries to fetch a fileNone, which leavescopybuttonSkipTextas undefined and breaks the copy functionality. If a theme usesjs_tagto include javascript files forsphinx>=1.8it works fine (maybesphinx>=1.8should also be a minimal requirement for this package?).If a theme doesn't have the following part (itcase-theme, pyviz-theme):
copybutton.jsdoes throw the following errorcopybutton.js:105 Uncaught ReferenceError: DOCUMENTATION_OPTIONS is not definedin the console (problem withclipboardButton) and even the icons aren't generated, due to early breaking.IMHO this should be mentioned in the docs, maybe in a topic like
theme support/requirements, so theme creators have a reference , if they want to supportsphinx-copybutton