Skip to content

Commit

Permalink
Add Website features page to rustdoc book
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlucthumm committed Jun 27, 2021
1 parent 68e3c49 commit 6c5c0a5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/doc/rustdoc/src/SUMMARY.md
Expand Up @@ -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)
25 changes: 25 additions & 0 deletions src/doc/rustdoc/src/website-features.md
@@ -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.

0 comments on commit 6c5c0a5

Please sign in to comment.