-
Notifications
You must be signed in to change notification settings - Fork 323
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
adding custom admonitions classes #183
Conversation
.. admonition:: If you add a name flag, it will be styled | ||
:name: warning | ||
.. admonition:: If you add a class flag, it will be styled | ||
:class: warning |
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 is nice - we don't need to use our hacky extra code to achieve this effect now - this is functionality that "already works" in Sphinx
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 is looking really great !!
One thing I am wondering: maybe we could still use bootstrap's color variables, since they basically define those same 4 colors (success, danger, warning, info + primary as fall back when no class is given): https://getbootstrap.com/docs/4.5/getting-started/theming/#theme-colors
That way we don't hardcode those colors, and you can customize them by overriding those set of colors.
docs/demo/demo.rst
Outdated
.. admonition:: If you add a name flag, it will be styled | ||
:name: warning | ||
.. admonition:: If you add a class flag, it will be styled | ||
:class: warning | ||
|
||
For example, this admonition block uses the following code: | ||
|
||
.. code-block:: | ||
|
||
.. admonition:: If you add a name flag, it will be styled |
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.
.. admonition:: If you add a name flag, it will be styled | |
.. admonition:: If you add a class flag, it will be styled |
src/scss/_base.scss
Outdated
@@ -110,3 +110,160 @@ pre { | |||
margin: 1.5em 0 1.5em 0; | |||
box-shadow: 1px 1px 1px #d8d8d8; | |||
} | |||
|
|||
// Admonitions CSS inspired by https://squidfunk.github.io/mkdocs-material/getting-started/ |
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.
maybe directly put this in a separate file _admonitions.scss
?
good points @jorisvandenbossche - I think I've addressed your comments! The colors look more "bootstrap-y" now :-) I also made "hint" be yellow, since I believe that's what other themes have used. But let me know if you'd really prefer green. |
anything else to do on this one? |
I actually was thinking of the success/danger/warning/info colors, but I suppose those are not available with a Anyway, that can certainly be done as a follow up as well. So merge away if you are happy with it! Some other possible follow-up thoughts:
cc @hoetmaaiers |
Mmm - if you can give me a very specific look that you'd like for these admonitions colors, then I can try to achieve that via some transparency...but otherwise I'd prefer we tackle in follow-up PRs because I see that as being tricky doing back-and-forth over a PR. For the custom classes stuff, I don't see it as too much of a hassle to just have our own CSS for some of this stuff. Or put another way, adding 5 lines of CSS seems way less-complex than creating a custom HTML5 translator to manually add bootstrap classes to things. |
ok cool - I'm gonna merge this so we have time to get a feel for it, I also opened up #187 to track the suggestions you made @jorisvandenbossche 👍 |
Thanks! |
This replaces our Bootstrap admonition styles with some custom ones that are heavily influenced by mkdocs-materials. It removes all of the admonition translator code, so our admonitions will now behave just like any other Sphinx theme's admonitions (which I think is good).
Also adds some colors and icons for the major admonitions that I found in the RTD theme docs.
Here's how they look on my machine:
What do you think?
closes #182 closes #181