diff --git a/CHANGES b/CHANGES index f85dfd6d..d2d20cc9 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,16 @@ $ uv add gp-sphinx --prerelease allow +### Fixes + +#### Type chips in parameter lists regain their padding + +Standalone type annotations in autodoc parameter and return lists — a +plain `str`, a `pathlib.Path`, the members of a union — rendered cramped +against the edge of their chip background. They now get their horizontal +breathing room back, while compound expressions such as `list[str]` and +`dict[str, Any]` still render flush at their brackets. (#54) + ## gp-sphinx 0.0.1a29 (2026-06-07) ### What's new diff --git a/packages/sphinx-autodoc-typehints-gp/src/sphinx_autodoc_typehints_gp/_static/css/typehints_gp.css b/packages/sphinx-autodoc-typehints-gp/src/sphinx_autodoc_typehints_gp/_static/css/typehints_gp.css index 3f20e851..567441ca 100644 --- a/packages/sphinx-autodoc-typehints-gp/src/sphinx_autodoc_typehints_gp/_static/css/typehints_gp.css +++ b/packages/sphinx-autodoc-typehints-gp/src/sphinx_autodoc_typehints_gp/_static/css/typehints_gp.css @@ -47,15 +47,25 @@ * blocks the compounding while still scaling with the root clamp * ramp on wide viewports. * - * `padding-inline: 0` cancels Furo's `padding: 0.1em 0.2em` - * horizontal component so the chip background sits flush against - * the bracket characters around it. Without this, generic types - * read with visible whitespace inside the brackets — `list[ str ]` - * instead of `list[str]` — because the brackets and commas live - * outside the chip and have no padding of their own. Vertical - * `0.1em` padding stays so the chip retains visible block height. */ + * Keep Furo's `0.2em` horizontal padding so a standalone type chip + * (`str`, `pathlib.Path`) reads as a chip with breathing room rather + * than text crammed against its background edge. The two overrides + * below cancel that padding only where a chip abuts `.p` punctuation + * (brackets, inner commas, pipes), so compound expressions still + * render flush — `list[str]`, not `list[ str ]` — because the + * brackets live outside the chip and have no padding of their own. + * Linked chips wrap the `` in ``, so the punctuation is the + * anchor's sibling; match both the bare and anchored forms. */ .field-list code.literal { font-size: 0.8125rem; - padding-inline: 0; + padding-inline: 0.2em; + } + .field-list code.literal:has(+ .p), + .field-list a.reference:has(+ .p) > code.literal { + padding-inline-end: 0; + } + .field-list .p + code.literal, + .field-list .p + a.reference > code.literal { + padding-inline-start: 0; } }