API Reference

Config reference

Generated from add_config_value() registrations in sphinx_ux_autodoc_layout/__init__.py.

api_layout_enabled
config env
config env
api_layout_enabled

Master switch for the componentized autodoc layout. When True, desc nodes emitted by domain autodocumenters are wrapped in api_region / api_signature / api_fold containers; when False, default Sphinx rendering is preserved unchanged.

Type:

bool

Default:

False

Registered by:

sphinx_ux_autodoc_layout.setup()

api_fold_parameters
config env
config env
api_fold_parameters

When True, parameter lists exceeding api_collapsed_threshold items are wrapped in a click-to-expand <details> element. Set to False to render every parameter inline regardless of count.

Type:

bool

Default:

True

Registered by:

sphinx_ux_autodoc_layout.setup()

api_collapsed_threshold
config env
config env
api_collapsed_threshold

Minimum number of parameters before api_fold_parameters=True collapses the list. Has no effect when folding is disabled.

Type:

int

Default:

10

Registered by:

sphinx_ux_autodoc_layout.setup()

api_signature_show_annotations
config env
config env
api_signature_show_annotations

When True, signature blocks render type annotations inline next to each parameter. False strips them — useful when annotations are documented separately in a Parameters section to avoid duplication.

Type:

bool

Default:

True

Registered by:

sphinx_ux_autodoc_layout.setup()

CSS classes

Class

Element

Purpose

gp-sphinx-api-container

<dl>

Managed autodoc shell

gp-sphinx-api-header

<dt>

Signature row shell

gp-sphinx-api-content

<dd>

Description/content shell

gp-sphinx-api-layout

<div>

Header split between left and right

gp-sphinx-api-layout-left

<div>

Signature text, custom disclosure, permalink

gp-sphinx-api-layout-right

<div>

Badge container and source link

gp-sphinx-api-signature

<div>

Compact signature row

gp-sphinx-api-link

<a>

Managed permalink in the left layout

gp-sphinx-api-badge-container

<span>

Wrapper for badge group output

gp-sphinx-api-source-link

<span>

Wrapper for the [source] link

gp-sphinx-api-description

<div>

Wraps paragraphs, notes, examples

gp-sphinx-api-parameters

<div>

Wraps field lists (Parameters, Returns)

gp-sphinx-api-footer

<div>

Wraps nested method/attribute entries

gp-sphinx-api-region

<div>

Compatibility alias on content sections

gp-sphinx-api-region--narrative

<div>

Compatibility alias on narrative sections

gp-sphinx-api-region--fields

<div>

Compatibility alias on parameter sections

gp-sphinx-api-region--members

<div>

Compatibility alias on footer/member sections

gp-sphinx-api-fold

<details>

Disclosure wrapper for large sections

gp-sphinx-api-fold-summary

<summary>

Click target showing field count

API reference

sphinx_ux_autodoc_layout.build_api_card_entry(*, profile_class, signature_children, content_children=(), badge_group=None, permalink=None, entry_classes=(), signature_classes=(), content_classes=())
function[source]
function[source]
sphinx_ux_autodoc_layout.build_api_card_entry(*, profile_class, signature_children, content_children=(), badge_group=None, permalink=None, entry_classes=(), signature_classes=(), content_classes=())

Build a shared gp-sphinx-api-* card entry for non-desc consumers.

The header emits both desktop and mobile layout variants side-by-side so theme CSS can container-query between them just like the managed desc_signature path does in _transforms. Header metadata (data-has-source, data-has-badges, data-badge-count, data-has-fold) is also added so styling can branch on facts the cascade can’t compute.

Parameters (10)
Parameters:
  • profile_class (str) – Stable profile class such as "gp-sphinx-api-profile--fastmcp-tool".

  • signature_children (Sequence[nodes.Node]) – Children placed inside the gp-sphinx-api-signature wrapper.

  • content_children (Sequence[nodes.Node]) – Children appended to gp-sphinx-api-content.

  • badge_group (nodes.Node | None) – Shared badge group rendered inside gp-sphinx-api-badge-container.

  • permalink (api_permalink | None) – Explicit header permalink placed in gp-sphinx-api-layout-left.

  • entry_classes (tuple[str, ...]) – Extra CSS classes for the outer gp-sphinx-api-entry wrapper.

  • signature_classes (tuple[str, ...]) – Extra classes for the gp-sphinx-api-signature wrapper.

  • content_classes (tuple[str, ...]) – Extra classes for the gp-sphinx-api-content wrapper.

Returns:

Shared card entry tree using the stable gp-sphinx-api-* contract.

Return type:

nodes.Element

sphinx_ux_autodoc_layout.build_api_summary_section(*children, classes=())
function[source]
function[source]
sphinx_ux_autodoc_layout.build_api_summary_section(*children, classes=())

Wrap summary or index content in the shared gp-sphinx-api-summary region.

Parameters:
  • *children (nodes.Node) – Summary or index nodes to render in the shared summary region.

  • classes (tuple[str, ...]) – Extra CSS classes appended to the summary wrapper.

Returns:

Shared summary wrapper.

Return type:

api_component

Examples

>>> from docutils import nodes
>>> section = build_api_summary_section(nodes.paragraph("", "Summary"))
>>> section.get("name")
'gp-sphinx-api-summary'
sphinx_ux_autodoc_layout.build_api_table_section(name, *children, classes=())
function[source]
function[source]
sphinx_ux_autodoc_layout.build_api_table_section(name, *children, classes=())

Wrap one or more table-like body nodes in a shared API section.

Parameters:
Return type:

api_component

sphinx_ux_autodoc_layout.build_api_facts_section(rows, *, classes=())
function[source]
function[source]
sphinx_ux_autodoc_layout.build_api_facts_section(rows, *, classes=())

Render a shared gp-sphinx-api-facts section from typed fact rows.

Parameters:
Return type:

api_component

Copyable config snippet

extensions = [
    "sphinx_ux_autodoc_layout",
]

Extension entry point

sphinx_ux_autodoc_layout.setup(app)
function[source]
function[source]
sphinx_ux_autodoc_layout.setup(app)

Register the extension with Sphinx.

Parameters:

app (Sphinx) – The Sphinx application object.

Returns:

Extension metadata.

Return type:

dict[str, Any]

Examples

>>> setup
<function setup at 0x...>