-
Notifications
You must be signed in to change notification settings - Fork 308
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
move parent theme css earlier in the inclusion order #451
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now also went ahead and removed the !important
parameters. The style changes are minimal, and can be easily undone if desired.
@@ -1,8 +1,8 @@ | |||
// Admonitions CSS originally inspired by https://squidfunk.github.io/mkdocs-material/getting-started/ | |||
|
|||
.admonition { | |||
div.admonition, .admonition{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a more specific selector div.admonition
, because this is how admonition styling is specified in basic.css
. I leave the more catch-all selector for compatibility and in case someone (me) wants to reuse the styling for colapsible admonitions that use a <details>
tag.
@@ -1,8 +1,8 @@ | |||
// Admonitions CSS originally inspired by https://squidfunk.github.io/mkdocs-material/getting-started/ | |||
|
|||
.admonition { | |||
div.admonition, .admonition{ | |||
margin: 1.5625em auto; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit now overrides the parent theme. Previously this margin was ignored. I am happy to undo this style change if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a nice change! I think I am a bit confused about what exactly the "blank" stuff is doing, perhaps you could explain here or via a commit to the code?
If I understand, because we weren't specifying a stylesheet
we were just inheriting the one that the Sphinx basic template uses. So this explicitly specifies the stylesheet so we don't inherit from Sphinx, but sets it to blank
because we really just want our own HTML theming to include the stylesheet manually. Is that right?
@@ -0,0 +1 @@ | |||
/* This file is intentionally left blank. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you provide more detail here about why this is blank? Imagine a new developer in the future that hasn't seen any of these issues coming across the CSS file, can we provide enough context that they understand why this is here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I explained it now.
Close, but not exactly. One way or another we use the parent stylesheet. Whether we want to remove it entirely is out of scope for this MR. The problem I'm addressing is that the parent stylesheet is included in the template after ours, leading to problems in overriding the defaults (some were actually overlooked I think). Plus the filename of ours is computed dynamically to avoid cache problems. To avoid this I do two things:
|
Co-authored-by: Chris Holdgraf <choldgraf@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this LGTM - agreed that it's better to have the upstream CSS loaded first so that we can override it if need be. I'll leave open for a little bit in case others have thoughts.
Thanks. Should I do anything about the lighthouse failing? (I've no idea how my changes are related.) |
@choldgraf didn't notice that the comment syntax was wrong ( |
Ah whoops, my bad |
lighthouse is broken on all PRs right now, not related to your changes |
ok gonna merge this in since the lighthouse thing is for all projects not just this one. many thanks @akhmerov ! |
So bootstrap has the following CSS for definition lists:
and that is now overwriting what sphinx basic theme does (instead of the other way around):
|
Likely a separate issue. Inspecting the outputs shows that the matching div has a |
For xarray, I think it is caused by removing the !important from |
Ah, but it seems that bootstrap also has an !important there, so that's probably the reason it was needed to overrule it |
Closes #447.
I achieve the desired result by making the theme css file empty (this overrides the
basic.css
provided by the parent theme), and@import
ing thebasic.css
in our owntheme.css
.This change should enable removing most of the
!important
properties (not done yet) and simplify implementing derived themes.