-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #106561 - GuillaumeGomez:warning-block, r=rustdoc
Add warning block support in rustdoc Fixes #79710. You can test it [here](https://rustdoc.crud.net/imperio/warning-block/foo/struct.Foo.html). It currently looks like this: ![image](https://user-images.githubusercontent.com/3050060/211413494-e1cf04e4-c081-4a9d-97db-27329405cfa7.png) So a few things to note: * Since it's a new add and it's changing the UI, we'll need to go through an FCP. * Does the UI looks good? * Is the way picked to add a warning block ok for everyone? The discussion on the issue seemed to be in favour of this solution but it doesn't hurt to double-check. cc `@rust-lang/rustdoc`
- Loading branch information
Showing
7 changed files
with
96 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Test to check that the "warning blocks" are displayed as expected. | ||
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" | ||
show-text: true | ||
|
||
define-function: ( | ||
"check-warning", | ||
(theme, color, border_color, background_color), | ||
block { | ||
set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} | ||
reload: | ||
|
||
// The IDs are added directly into the DOM to make writing this test easier. | ||
assert-css: ("#doc-warning-1", { | ||
"margin-bottom": "12px", | ||
"color": |color|, | ||
"border-left": "2px solid " + |border_color|, | ||
"background-color": |background_color|, | ||
}) | ||
assert-css: ("#doc-warning-2", { | ||
"margin-bottom": "0px", | ||
"color": |color|, | ||
"border-left": "2px solid " + |border_color|, | ||
"background-color": |background_color|, | ||
}) | ||
}, | ||
) | ||
|
||
call-function: ("check-warning", { | ||
"theme": "ayu", | ||
"color": "rgb(197, 197, 197)", | ||
"border_color": "rgb(255, 142, 0)", | ||
"background_color": "rgba(0, 0, 0, 0)", | ||
}) | ||
call-function: ("check-warning", { | ||
"theme": "dark", | ||
"color": "rgb(221, 221, 221)", | ||
"border_color": "rgb(255, 142, 0)", | ||
"background_color": "rgba(0, 0, 0, 0)", | ||
}) | ||
call-function: ("check-warning", { | ||
"theme": "light", | ||
"color": "rgb(0, 0, 0)", | ||
"border_color": "rgb(255, 142, 0)", | ||
"background_color": "rgba(0, 0, 0, 0)", | ||
}) |