Skip to content

Commit 19920eb

Browse files
authored
Improve admonition compatibility with inline code and code blocks (#291)
* Improve inline code styling inside admonitions Closes STA-5322 * Ensure admonitions containing code don’t overflow and improve colours
1 parent a3a6dce commit 19920eb

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/css/custom.css

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,9 @@ html[data-theme='light'] body {
349349
--st-header-border: var(--st-gray-100);
350350
--st-layout-border: var(--st-gray-100);
351351
--st-layout-border-secondary: var(--st-gray-100);
352-
--st-code-border: var(--st-gray-100);
353-
--st-codeblock-background: white;
352+
--st-code-border: transparent;
353+
--st-codeblock-background: rgba(255, 255, 255, 0.2);
354+
--st-admonition-codeblock-background: rgba(255, 255, 255, 0.2);
354355
--st-code-inline-border: 1px solid rgba(191, 227, 248, 0.5); /* var(--st-blue-100) in rgba */
355356
--st-code-inline-text: var(--st-blue-900);
356357
--st-code-highlight-background: var(--st-blue-50);
@@ -507,6 +508,7 @@ html[data-theme='dark'] body {
507508
--st-code-inline-border: 1px solid rgba(69, 71, 79, 0.5); /* var(--st-gray-700) in rgba */
508509
--st-code-inline-text: var(--st-gray-50);
509510
--st-codeblock-background: rgba(0, 0, 0, 0.1);
511+
--st-admonition-codeblock-background: rgba(0, 0, 0, 0.7);
510512
--st-code-highlight-background: var(--st-gray-850);
511513
--docusaurus-highlighted-code-line-bg: var(--st-code-highlight-background);
512514
--st-copy-button-background: var(--st-blue-700);
@@ -616,7 +618,7 @@ html[data-theme='light'] .theme-code-block pre {
616618
}
617619

618620
html[data-theme='light'] .theme-code-block {
619-
border: 1px solid var(--st-code-border);
621+
border: none;
620622
}
621623

622624
html[data-theme='dark'] .theme-code-block,
@@ -626,7 +628,7 @@ html[data-theme='dark'] .theme-code-block pre {
626628
}
627629

628630
html[data-theme='dark'] .theme-code-block {
629-
border: 1px solid var(--st-code-border);
631+
border: none;
630632
}
631633

632634
/* Specific font-variation-settings for web font support */
@@ -1268,8 +1270,8 @@ footer [class*='iconExternalLink'] {
12681270
box-shadow: none;
12691271
color: var(--ifm-alert-foreground-color);
12701272
display: grid;
1271-
grid-template-columns: 1.2em 1fr;
1272-
grid-template-rows: 1fr;
1273+
grid-template-columns: 1.2em minmax(auto, calc(100% - 1.2em));
1274+
grid-template-rows: auto;
12731275
grid-column-gap: 0.5em;
12741276
grid-row-gap: 0;
12751277
font-size: 0.95rem;
@@ -1306,6 +1308,17 @@ details summary::before {
13061308
--ifm-alert-border-color: var(--st-tip-accent);
13071309
}
13081310

1311+
.alert code {
1312+
background-color: var(--st-admonition-codeblock-background);
1313+
border-color: var(--st-admonition-codeblock-background);
1314+
color: var(--ifm-alert-foreground-color);
1315+
}
1316+
1317+
.alert pre code {
1318+
background-color: var(--st-admonition-codeblock-background);
1319+
border-color: inherit;
1320+
}
1321+
13091322
.alert--secondary {
13101323
--ifm-alert-background-color: var(--st-tip-background);
13111324
--ifm-alert-background-color-highlight: var(--st-tip-accent);

0 commit comments

Comments
 (0)