Skip to content

Add warning sections in rustdoc #79677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
@@ -332,10 +332,23 @@ nav.sub {

.rustdoc:not(.source) .example-wrap {
display: inline-flex;
}
.rustdoc:not(.source) .example-wrap, #main div.rustdoc-warning {
margin-bottom: 10px;
position: relative;
}

#main div.rustdoc-warning {
padding: 10px;
border-left: 2px solid;
}
#main div.rustdoc-warning::before {
content: "⚠";
position: absolute;
left: -25px;
font-size: 20px;
}

.example-wrap {
width: 100%;
}
9 changes: 8 additions & 1 deletion src/librustdoc/html/static/themes/ayu.css
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ span code {
.docblock code, .docblock-short code {
background-color: #191f26;
}
pre {
pre, #main div.rustdoc-warning {
color: #e6e1cf;
background-color: #191f26;
}
@@ -336,6 +336,13 @@ a.test-arrow:hover {
border-right: 3px solid rgba(255, 180, 76, 0.85);
}

#main div.rustdoc-warning {
border-left-color: #f00;
}
#main div.rustdoc-warning::before {
color: #f00;
}

pre.compile_fail {
border-left: 2px solid rgba(255,0,0,.4);
}
9 changes: 8 additions & 1 deletion src/librustdoc/html/static/themes/dark.css
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ h4:not(.method):not(.type):not(.tymethod) {
.docblock code, .docblock-short code {
background-color: #2A2A2A;
}
pre {
pre, #main div.rustdoc-warning {
background-color: #2A2A2A;
}

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

#main div.rustdoc-warning {
border-left-color: #f00;
}
#main div.rustdoc-warning::before {
color: #f00;
}

pre.compile_fail {
border-left: 2px solid rgba(255,0,0,.8);
}
9 changes: 8 additions & 1 deletion src/librustdoc/html/static/themes/light.css
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ h4:not(.method):not(.type):not(.tymethod) {
.docblock code, .docblock-short code {
background-color: #F5F5F5;
}
pre {
pre, #main div.rustdoc-warning {
background-color: #F5F5F5;
}

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

#main div.rustdoc-warning {
border-left-color: #f00;
}
#main div.rustdoc-warning::before {
color: #f00;
}

pre.compile_fail {
border-left: 2px solid rgba(255,0,0,.5);
}