Add support for classref admonitions#12017
Conversation
|
FYI, it seems you used your no-reply email from GitLab instead of GitHub for your godot-docs clone, so the commit doesn't appear linked to your GitHub account. |
634d425 to
f516bf3
Compare
f516bf3 to
80edf43
Compare
|
Fixed saturation being applied twice to the title, and made saturation theme-dependent. @Mickeon mentioned all existing admonitions using the same icon, so this PR will not try to get the "right" icon for each type.
|
Mickeon
left a comment
There was a problem hiding this comment.
I do approve this in principle as I have godotengine/godot#111375 already. I can't speak much about the code required for it, but as we discussed the styling it's currently pretty good.
In due time we should also update the contributors documentation to mention these admonitions.
0d27adb to
c10ae64
Compare
|
I cleaned up the unused icon and paragraph functions in the python file, and added icons using the SVG files from the editor (the same ones as godotengine/godot#111375). They can be added to standard admonitions in a separate PR if needed.
|
|
Just a quick note on the
waiting on pr merge
|
There was a problem hiding this comment.
Tested locally on Firefox 150 and Chromium 148, it works as expected.
color-mix is well-supported in CSS overall (it's considered Baseline now).
|
Left a note on godotengine/godot#111375 that this PR is good to go if a decision is made to merge the feature. |






godotengine/godot#111375 adds support for admonitions in the editor, but there were concerns about the size of Sphinx admonitions for the online documentation, especially since some class properties/methods have multiple consecutive notes. That PR now generates a special rST directive, which this PR adds support for, via a custom extension and some CSS.
The extension itself was made using some AI help, maybe the ClassrefAdmonitionHTMLTranslator class warrants a closer look, and the global visit_paragraph and depart_paragraph functions that are linked to it. The rest looks alright to me and not unlike what I could see in other extensions.
The following screenshot is from the Resource page, with all Note:, Warning:, Tip:, and Important: admonitions converted using godotengine/godot#111375:


Here are all the available types of admonitions:
If someone knows how to get the correct icons from admonitions, I'd like to have those instead of a generic admonition icon.