-
Notifications
You must be signed in to change notification settings - Fork 32
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
customized admonition #186
Conversation
735c19e
to
ec0b6c2
Compare
Minor suggestion: perhaps instead of having the user instantiate a Fromfrom sphinx_immaterial.custom_admonitions import CustomAdmonition
sphinx_immaterial_custom_admonitions = [
CustomAdmonition(
name="example-admonition",
color=(198, 177, 6),
icon="material/school",
),
] Tosphinx_immaterial_custom_admonitions = [
{
"name": "example-admonition",
"color": (198, 177, 6),
"icon": "material/school",
},
] |
I had considered it, but using dicts are problematic because undetected typos in the keys may result in its value not being used (& unused keys not noted during build time). We had worked around this in the past with the The other reason I didn't use a dict is because a class constructor can fill in unspecified default values for free (kwargs in c'tor). Plus, I can do type checking on the values (like making sure the color is I'm not shooting it down, it should be possible, but I just found it quicker to get up and running with the class approach. Under the hood, it is still quite flexible to make a switch. I'll try it out in the coming days (still refining/testing the admonitions that override existing directives in sphinx). |
I have been rather annoyed by a problem in our docs which always shows the |
I also like Matt's suggestion. If you use pydantic to define a data class and to parse the option in config_inited, that will take care of type checking and defaults. |
Will do. I'm just finishing up the todo directive override now. |
So switching to pydantic was easy, but now I'm trying to document the config values' datatypes... Currently trying to follow what was done for the obj_desc_opts, but it is complex. So far, I've created the new |
Does autodoc not work to document the dataclass? |
Oh, I hadn't thought to do it that way. I was trying to move away from autodoc because the rogue |
How about adding it to https://github.com/jbms/sphinx-immaterial/blob/main/docs/apidoc/cpp/apigen.rst |
This comment was marked as outdated.
This comment was marked as outdated.
Opening this up for review. Some changes to the generic admonitions should bring compliance to the deprecated aliased admonition CSS classes in upstream. Some of the classes getting removed in upstream v9.0 will have to be added back as Sphinx already has specific admonition directives that upstream CSS won't style. Namely, these classes are
On the plus side, this will give us a chance to style them more uniquely (if desired). The main reason these CSS classes are deprecated is to cut back on the CSS bundle's footprint, but mkdocs isn't constrained by predefined admonitions like we are. |
I think we need to reduce the workflow CI triggers. It is excessive to have the workflow run 2x for every commit in an open PR. I'm running into bandwidth/connection problems and it takes a pretty long time to complete 1x workflow run. I've gotten more comfortable using pre-commit, which we can use to reduce linting errors reported in CI, cache dependencies on the github runner, trim trailing whitespace, detect yaml/json syntax errors, and ensure uniform line endings. FYI, the coverage pkg's |
I think if you change
to on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch: that should do the trick. |
not a fan of limiting by branch because we dev on any branch but main. I was thinking more like limiting the PR sync events: on:
push:
pull_request:
types: [opened, closed, repoened]
workflow_dispatch: |
switch to SphinxRole for inline icons role
This means only the name field is required.
Looks good to me, thanks for all your work on this! |
solves #183 and conforms #182 with improvements used here.