Add Website features page to rustdoc book

This commit is contained in:
Jean-Luc Thumm 2021-06-22 15:40:37 -07:00
parent 68e3c49cdf
commit 6c5c0a5853
2 changed files with 26 additions and 0 deletions

View file

@ -10,5 +10,6 @@
- [Lints](lints.md)
- [Advanced features](advanced-features.md)
- [Unstable features](unstable-features.md)
- [Website features](website-features.md)
- [Passes](passes.md)
- [References](references.md)

View file

@ -0,0 +1,25 @@
# Website features
These features are about using the website generated by `rustdoc`.
## Custom search engines
If you find yourself often referencing online Rust docs you might enjoy using a custom search
engine. This allows you to use the navigation bar directly to search a `rustdoc` website.
Most browsers support this feature by letting you define a URL template containing `%s`
which will be substituted for the search term. As an example, for the standard library you could use
this template:
```text
https://doc.rust-lang.org/stable/std/?search=%s
```
Note that this will take you to a results page listing all matches. If you want to navigate to the first
result right away (which is often the best match) use the following instead:
```text
https://doc.rust-lang.org/stable/std/?search=%s&go_to_first=true
```
This URL adds the `go_to_first=true` query parameter which can be appended to any `rustdoc` search URL
to automatically go to the first result.