-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Setting html_context['css_files'] renders add_stylesheet() inoperative #2442
Comments
I don't know the behavior is intentional or not. Now sphinx provides Any reason to use |
I think the one obvious way for a "normal" user to provide custom settings to Sphinx is defining variables (e.g. OTOH, the one obvious way for "extension writers" to extend (and "enhance") the user-specified settings is to use the application API from the extension's I know it's also possible for "normal" users to define a Adding style definitions to the existing CSS definitions is IMHO a quite "normal" thing to do for a "normal" user, therefore it should be possible by simply assigning to a variable in If for some technical reason See also my comments readthedocs/readthedocs.org#2116 (comment) and readthedocs/readthedocs.org#2116 (comment). |
@tk0miya Let me add a bit of background on the request. Project Jupyter/IPython notebooks rely on using @mgeier's nbsphinx package for including notebooks in Sphinx documentation. This workflow has worked really well for us except for unexpected CSS rendering breakage from time to time. The devs on Sphinx, ReadTheDocs (@ericholscher, @agjohnson), and nbsphinx are doing great work. I'm wondering what we can do to make it easier for Jupyter and our users create docs using nbsphinx and custom themes to simplify configuration (ideally in conf.py). Thanks all. Looking forward to everyone's thoughts.:smile: |
Sounds like what folks want is just another setting like
Personally I don't think the extension solution is bad, and allows full access to the app API, which a settings file doesn't support. You extension could easily include the |
@ericholscher Sure, the extension could easily use And yes, a |
I'm trying to add a custom stylesheet on RTD. I do the following: on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = ['.', sphinx_rtd_theme.get_html_theme_path()]
html_context = {
'css_files': [
'_static/theme_overrides.css', # override wide tables in RTD theme
],
} But this means that when building on the RTD server, my build doesn't contain the theme's stylesheet. Building locally works. Based on my intuition of reading the configuration, I am surprised to see that things work locally and then break when deployed to the RTD servers. I think the issue is legit. Additionally, if the behaviour is undefined, then it's more okay to introduce a definition. If there was an existing definition or convention, it would be a problem. |
I'd like to add a new config value Thanks, |
@tk0miya That's great! I'm just not sure about the names of the configuration options. I'm not a native speaker, but And correspondingly |
Let's discuss in #4595. Then other reviewer will see your comment. Note: I don't mind about wording. I'm also not native. But we have to consider that it also accepts URLs of JS (or CSS). I feel |
Finally, #4815 is merged instead. |
Great work @tk0miya ! As I read the description of the PR, it indeed solves the symptom described in the issue:
It does this now, but with a deprecation message, right? |
|
Okay, that's what I was wondering. Thanks for clarifying :) |
When I use something like this in my
conf.py
:... and an extension uses add_stylesheet(), latter has no effect.
Is this intentional?
I would expect the
css_files
mentioned inconf.py
to be appended to the list of CSS files from the theme and from extensions.The text was updated successfully, but these errors were encountered: