From 6f8b074eda9b61d320def7459ead974b06b0d9c5 Mon Sep 17 00:00:00 2001 From: David Oliver Date: Fri, 20 Feb 2026 00:03:27 +0100 Subject: [PATCH 1/3] Preserve admonition block heading styles in docstring content Fixes #2201 --- assets/css/content/functions.css | 34 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/assets/css/content/functions.css b/assets/css/content/functions.css index ca50e6e12..be73f82c0 100644 --- a/assets/css/content/functions.css +++ b/assets/css/content/functions.css @@ -85,23 +85,25 @@ in both HTML and ePub. */ } } -/* Docstring headings */ .content-inner .docstring { - & :is(h1, h2, h3, h4, h5, h6) { - font-weight: 700; - font-size: 1em; - margin-top: 2em; - } - /* h1 not expected */ - & :is(h1, h2) { - font-size: 1.1em; - } - /* h4 the last level expected: smallcaps */ - & :is(h4) { - font-size: .8em; - text-transform: uppercase; - letter-spacing: .1em; - color: var(--textBody); + /* Docstring headings - should not apply to admonition block headings */ + & :not([class~='admonition-title']) { + &:is(h1, h2, h3, h4, h5, h6) { + font-weight: 700; + font-size: 1em; + margin-top: 2em; + } + /* h1 not expected */ + &:is(h1, h2) { + font-size: 1.1em; + } + /* h4 the last level expected: smallcaps */ + &:is(h4) { + font-size: .8em; + text-transform: uppercase; + letter-spacing: .1em; + color: var(--textBody); + } } } From 90374e77701abcb313658e99cef2bdfe9f26f138 Mon Sep 17 00:00:00 2001 From: David Oliver Date: Fri, 20 Feb 2026 12:51:50 +0100 Subject: [PATCH 2/3] Simplify :not() function selector --- assets/css/content/functions.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/css/content/functions.css b/assets/css/content/functions.css index be73f82c0..1f3baeaeb 100644 --- a/assets/css/content/functions.css +++ b/assets/css/content/functions.css @@ -87,7 +87,7 @@ in both HTML and ePub. */ .content-inner .docstring { /* Docstring headings - should not apply to admonition block headings */ - & :not([class~='admonition-title']) { + & :not(.admonition-title) { &:is(h1, h2, h3, h4, h5, h6) { font-weight: 700; font-size: 1em; From 46ed3d2dac08911771981f23baf49cd20fe3bce5 Mon Sep 17 00:00:00 2001 From: David Oliver Date: Fri, 20 Feb 2026 14:35:05 +0100 Subject: [PATCH 3/3] Simplify docstring headings Removes uppercasing of docstring h4. Sligtly increases docstring h2, allowing differentiation of h2-h4. --- assets/css/content/functions.css | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/assets/css/content/functions.css b/assets/css/content/functions.css index 1f3baeaeb..0ee71f7b9 100644 --- a/assets/css/content/functions.css +++ b/assets/css/content/functions.css @@ -86,7 +86,7 @@ in both HTML and ePub. */ } .content-inner .docstring { - /* Docstring headings - should not apply to admonition block headings */ + /* Docstring headings: h2-h4 expected; should not apply to admonition blocks within docstring. */ & :not(.admonition-title) { &:is(h1, h2, h3, h4, h5, h6) { font-weight: 700; @@ -95,14 +95,10 @@ in both HTML and ePub. */ } /* h1 not expected */ &:is(h1, h2) { - font-size: 1.1em; + font-size: 1.25em; } - /* h4 the last level expected: smallcaps */ - &:is(h4) { - font-size: .8em; - text-transform: uppercase; - letter-spacing: .1em; - color: var(--textBody); + &:is(h3) { + font-size: 1.1em; } } }