How to¶
Features¶
Type badges (rightmost):
function,class,method,property,attribute,data,exception— each with a distinct colorModifier badges (left of type):
async,classmethod,staticmethod,abstract,final,deprecatedCard containers: bordered cards with secondary-background headers
Dark mode: full light/dark theming via CSS custom properties
Accessibility: keyboard-focusable badges with tooltip popups
Non-invasive: hooks into
doctree-resolvedwithout replacing directives
Downstream conf.py¶
Add sphinx_autodoc_api_style to your Sphinx extensions. With gp-sphinx,
use extra_extensions:
conf = merge_sphinx_config(
project="my-project",
version="1.0.0",
copyright="2026, Your Name",
source_repository="https://github.com/your-org/my-project/",
extra_extensions=["sphinx_autodoc_api_style"],
)
Or without merge_sphinx_config:
extensions = ["sphinx_autodoc_api_style"]
sphinx_autodoc_api_style automatically registers sphinx_ux_badges and
sphinx_ux_autodoc_layout via app.setup_extension(). You do not need to add
them separately to your extensions list.
CSS prefix¶
All badge CSS classes use the sab- prefix from sphinx-ux-badges.
Layout card classes (borders, headers, field-list rules) are local to this package
and use dl.py-* and .api-* selectors.
Copyable config snippet
extensions = [
"sphinx_autodoc_api_style",
]