Skip to content

Commit 7094920

Browse files
Merge pull request #9773 from circleci/fix/code-block-in-block-formatting
Fix formatting bugs for code in blocks
2 parents e8f189d + 2a6270f commit 7094920

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

ui/src/css/doc.css

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
.doc p code,
200200
.doc thead code,
201201
.doc .colist > table code,
202-
.doc .admonitionblock td.content code {
202+
.doc .admonitionblock td.content code:not(.hljs) {
203203
color: var(--code-font-color);
204204
background: #F7F7F7;
205205
border-radius: 4px;
@@ -209,6 +209,13 @@
209209
white-space: nowrap;
210210
}
211211

212+
/* Allow inline code to wrap in admonition blocks to prevent overflow */
213+
.doc .admonitionblock td.content code:not(.hljs) {
214+
white-space: normal;
215+
word-break: break-word;
216+
overflow-wrap: break-word;
217+
}
218+
212219
.doc code,
213220
.doc pre {
214221
hyphens: none;
@@ -970,19 +977,13 @@
970977
margin-top: 0;
971978
}
972979

973-
/* Fix wrapping issues inside sidebarblocks */
974-
.doc .sidebarblock code {
980+
/* Fix wrapping issues inside sidebarblocks - only for inline code, not code blocks */
981+
.doc .sidebarblock code:not(.hljs) {
975982
white-space: normal;
976983
word-break: break-word;
977984
overflow-wrap: break-word;
978985
}
979986

980-
.doc .sidebarblock .listingblock pre {
981-
white-space: pre-wrap;
982-
word-break: break-word;
983-
overflow-wrap: break-word;
984-
}
985-
986987
.doc .sidebarblock .listingblock {
987988
width: 100%;
988989
max-width: 100%;
@@ -1460,11 +1461,11 @@
14601461
font-weight: var(--heading-font-weight);
14611462
}
14621463

1463-
/* Prevent inline code text from wrapping in table cells */
1464-
td .pre,
1465-
td .code,
1466-
td p code,
1467-
td li code,
1464+
/* Prevent inline code text from wrapping in table cells (but not in admonition blocks) */
1465+
.tableblock td .pre,
1466+
.tableblock td .code,
1467+
.tableblock td p code,
1468+
.tableblock td li code,
14681469
.tableblock p code,
14691470
.tableblock li code {
14701471
white-space: nowrap !important;

0 commit comments

Comments
 (0)