From 9bb85df4a1e2de4ed1419e4337afc4a1366b2e03 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 7 Jun 2026 15:58:04 -0500 Subject: [PATCH 1/2] gp-sphinx(typehints-gp[chips]): Pad standalone type chips, flush at brackets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit why: Field-list type chips — standalone types like str and pathlib.Path and union members — rendered with zero horizontal padding, so each type sat crammed against the edge of its chip background. The padding was zeroed globally to keep compound types tight (list[str], not list[ str ]). what: - Restore Furo's 0.2em inline padding on .field-list code.literal - Cancel it only where a chip abuts .p punctuation (brackets, inner commas, pipes), matching both the bare and the -wrapped link form, so list[str] and dict[str, Any] still render flush --- .../_static/css/typehints_gp.css | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) 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; } } From d0abf80660a2a01c503abf2a99edf0521d5a3ce3 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 7 Jun 2026 16:02:26 -0500 Subject: [PATCH 2/2] docs(CHANGES) Parameter type-chip padding fix --- CHANGES | 10 ++++++++++ 1 file changed, 10 insertions(+) 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