From 82742634184e756d28ad5be58ca22c3b67e66b91 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Wed, 30 Apr 2025 19:35:51 +0100 Subject: [PATCH 1/3] Fix layout, styles of admon block with labels --- src/css/labels.css | 17 ++--------------- src/js/60-docs-roles.js | 8 +++++++- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/css/labels.css b/src/css/labels.css index 72f926f1..74320192 100644 --- a/src/css/labels.css +++ b/src/css/labels.css @@ -14,8 +14,8 @@ div.labels { flex-wrap: wrap; } -.admonitionblock > div.labels { - padding: 1rem 1rem 0.75rem; +.admonitionblock div.labels { + padding: 0.5rem 0 1rem; } .header-label-container > div.labels { @@ -62,19 +62,6 @@ h1 > .header-label { margin-bottom: 0.2rem; } -.has-label { - padding-left: 0.4rem; - border-left: 2px solid rgba(var(--colors-baltic-60)); -} - -.has-label:has(> .labels > .label--new) { - border-left-color: var(--success-color); -} - -.has-label:has(> .labels > .label--deprecated) { - border-left-color: var(--deprecated-color); -} - h2 > .flex-label { float: inline-end; line-height: var(--doc-line-height); diff --git a/src/js/60-docs-roles.js b/src/js/60-docs-roles.js index 96debded..587f630c 100644 --- a/src/js/60-docs-roles.js +++ b/src/js/60-docs-roles.js @@ -140,7 +140,7 @@ document.addEventListener('DOMContentLoaded', function () { // no need to do anything if we found only undefined roles if (labels.length === 0) return - const labelsLocation = (roleDiv.firstElementChild && headings.includes(roleDiv.firstElementChild.nodeName)) ? roleDiv.firstElementChild : roleDiv + let labelsLocation = (roleDiv.firstElementChild && headings.includes(roleDiv.firstElementChild.nodeName)) ? roleDiv.firstElementChild : roleDiv const labelsDiv = createElement('div', 'labels') for (const label of labels) { @@ -154,6 +154,12 @@ document.addEventListener('DOMContentLoaded', function () { } } + console.log(roleDiv.classList) + + if (roleDiv.classList.contains('admonitionblock')) { + labelsLocation = roleDiv.querySelector('td.content') + } + if (roleDiv.nodeName === 'H1' || headings.includes(roleDiv.firstElementChild.nodeName)) { labelsLocation.append(labelsDiv) labelsLocation.classList.add('header-label-container') From 6b34d8fe29c4adc2697219632024c9b3d9528289 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Thu, 1 May 2025 10:21:17 +0100 Subject: [PATCH 2/3] restore border for labeled paragraphs --- src/css/labels.css | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/css/labels.css b/src/css/labels.css index 74320192..12ff80d0 100644 --- a/src/css/labels.css +++ b/src/css/labels.css @@ -62,6 +62,21 @@ h1 > .header-label { margin-bottom: 0.2rem; } + +.paragraph.has-label { + padding-left: 0.4rem; + border-left: 2px solid rgba(var(--colors-baltic-60)); +} + +.paragraph.has-label:has(> .labels > .label--new) { + border-left-color: var(--success-color); +} + +.paragraph.has-label:has(> .labels > .label--deprecated) { + border-left-color: var(--deprecated-color); +} + + h2 > .flex-label { float: inline-end; line-height: var(--doc-line-height); From c8dbfcbd01347dbcf4071c61d1dadf75571c6b67 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Thu, 1 May 2025 10:21:35 +0100 Subject: [PATCH 3/3] restore border for labeled paragraphs --- src/css/labels.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/css/labels.css b/src/css/labels.css index 12ff80d0..b8681de6 100644 --- a/src/css/labels.css +++ b/src/css/labels.css @@ -62,7 +62,6 @@ h1 > .header-label { margin-bottom: 0.2rem; } - .paragraph.has-label { padding-left: 0.4rem; border-left: 2px solid rgba(var(--colors-baltic-60)); @@ -76,7 +75,6 @@ h1 > .header-label { border-left-color: var(--deprecated-color); } - h2 > .flex-label { float: inline-end; line-height: var(--doc-line-height);