Skip to content

Commit 2e3d5c8

Browse files
committed
Document the html_root_url doc attribute value.
1 parent bd31c39 commit 2e3d5c8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/doc/rustdoc/src/the-doc-attribute.md

+15
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ the tracking issue.
9292
#![doc(issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/")]
9393
```
9494

95+
### `html_root_url`
96+
97+
The `#[doc(html_root_url = "…")]` attribute value indicates the URL for
98+
generating links to external crates. When rustdoc needs to generate a link to
99+
an item in an external crate, it will first check if the extern crate has been
100+
documented locally on-disk, and if so link directly to it. Failing that, it
101+
will use the URL given by the `--extern-html-root-url` command-line flag if
102+
available. If that is not available, then it will use the `html_root_url`
103+
value in the extern crate if it is available. If that is not available, then
104+
the extern items will not be linked.
105+
106+
```rust,ignore
107+
#![doc(html_root_url = "https://docs.rs/serde/1.0")]
108+
```
109+
95110
### `html_no_source`
96111

97112
By default, `rustdoc` will include the source code of your program, with links

0 commit comments

Comments
 (0)