Skip to content

Commit 2ae0697

Browse files
authored
Rollup merge of rust-lang#60278 - ehuss:doc-html_root_url, r=GuillaumeGomez
Document the `html_root_url` doc attribute value. I'm not sure if this was intentionally not documented, but I think it would be good to include. This was added in rust-lang#9691. `--extern-html-root-url` is unstable, but I don't think it hurts to mention it.
2 parents a6be03f + 2e3d5c8 commit 2ae0697

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
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)