about summary refs log tree commit diff
path: root/src/doc/rustdoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-21 09:26:02 +0000
committerbors <bors@rust-lang.org>2023-08-21 09:26:02 +0000
commit5e9d3d8a03fadf1877286528e5c9d0c056ac82b5 (patch)
tree0e0cca951a100efb438f09aabfd61021f3016419 /src/doc/rustdoc
parentc40cfcf0494ff7506e753e750adb00eeea839f9c (diff)
parent1d42913058d4005655ea51b2d9dde707791c6541 (diff)
Auto merge of #106561 - GuillaumeGomez:warning-block, r=rustdoc
Add warning block support in rustdoc

Fixes https://github.com/rust-lang/rust/issues/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`
Diffstat (limited to 'src/doc/rustdoc')
-rw-r--r--src/doc/rustdoc/src/how-to-write-documentation.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/how-to-write-documentation.md b/src/doc/rustdoc/src/how-to-write-documentation.md
index 1fa9f814476..acab1a93690 100644
--- a/src/doc/rustdoc/src/how-to-write-documentation.md
+++ b/src/doc/rustdoc/src/how-to-write-documentation.md
@@ -254,6 +254,19 @@ characters:
 
 So, no need to manually enter those Unicode characters!
 
+### Adding a warning block
+
+If you want to make a warning or similar note stand out in the documentation,
+you can wrap it like this:
+
+```md
+/// documentation
+///
+/// <div class="warning">A big warning!</div>
+///
+/// more documentation
+```
+
 [`backtrace`]: https://docs.rs/backtrace/0.3.50/backtrace/
 [commonmark markdown specification]: https://commonmark.org/
 [commonmark quick reference]: https://commonmark.org/help/