Skip to content

Commit c8bad79

Browse files
Add support for warning section
1 parent c7cff21 commit c8bad79

File tree

4 files changed

+37
-3
lines changed

4 files changed

+37
-3
lines changed

src/librustdoc/html/static/rustdoc.css

+13
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,23 @@ nav.sub {
332332

333333
.rustdoc:not(.source) .example-wrap {
334334
display: inline-flex;
335+
}
336+
.rustdoc:not(.source) .example-wrap, #main div.rustdoc-warning {
335337
margin-bottom: 10px;
336338
position: relative;
337339
}
338340

341+
#main div.rustdoc-warning {
342+
padding: 10px;
343+
border-left: 2px solid;
344+
}
345+
#main div.rustdoc-warning::before {
346+
content: "⚠";
347+
position: absolute;
348+
left: -25px;
349+
font-size: 20px;
350+
}
351+
339352
.example-wrap {
340353
width: 100%;
341354
}

src/librustdoc/html/static/themes/ayu.css

+8-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ span code {
5353
.docblock code, .docblock-short code {
5454
background-color: #191f26;
5555
}
56-
pre {
56+
pre, #main div.rustdoc-warning {
5757
color: #e6e1cf;
5858
background-color: #191f26;
5959
}
@@ -336,6 +336,13 @@ a.test-arrow:hover {
336336
border-right: 3px solid rgba(255, 180, 76, 0.85);
337337
}
338338

339+
#main div.rustdoc-warning {
340+
border-left-color: #f00;
341+
}
342+
#main div.rustdoc-warning::before {
343+
color: #f00;
344+
}
345+
339346
pre.compile_fail {
340347
border-left: 2px solid rgba(255,0,0,.4);
341348
}

src/librustdoc/html/static/themes/dark.css

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ h4:not(.method):not(.type):not(.tymethod) {
2626
.docblock code, .docblock-short code {
2727
background-color: #2A2A2A;
2828
}
29-
pre {
29+
pre, #main div.rustdoc-warning {
3030
background-color: #2A2A2A;
3131
}
3232

@@ -285,6 +285,13 @@ a.test-arrow:hover{
285285
border-right: 3px solid #bb7410;
286286
}
287287

288+
#main div.rustdoc-warning {
289+
border-left-color: #f00;
290+
}
291+
#main div.rustdoc-warning::before {
292+
color: #f00;
293+
}
294+
288295
pre.compile_fail {
289296
border-left: 2px solid rgba(255,0,0,.8);
290297
}

src/librustdoc/html/static/themes/light.css

+8-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ h4:not(.method):not(.type):not(.tymethod) {
2828
.docblock code, .docblock-short code {
2929
background-color: #F5F5F5;
3030
}
31-
pre {
31+
pre, #main div.rustdoc-warning {
3232
background-color: #F5F5F5;
3333
}
3434

@@ -277,6 +277,13 @@ a.test-arrow:hover{
277277
border-right: 3px solid #ffb44c;
278278
}
279279

280+
#main div.rustdoc-warning {
281+
border-left-color: #f00;
282+
}
283+
#main div.rustdoc-warning::before {
284+
color: #f00;
285+
}
286+
280287
pre.compile_fail {
281288
border-left: 2px solid rgba(255,0,0,.5);
282289
}

0 commit comments

Comments
 (0)