-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow sidebar links to be specified for Rustdoc #74226
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @GuillaumeGomez (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
First, thanks for opening this PR! Now, a few things to be noted though:
What do you think @rust-lang/rustdoc ? |
I think that if it were a section for index.html then you could just put the links in the inner doc of I quite like seeing where it shows up in the examples in the screenshots, but I wonder if this will end up conflicting with things docs.rs might want to inject? |
☔ The latest upstream changes (presumably #73767) made this pull request unmergeable. Please resolve the merge conflicts. |
025bdf1
to
9a0dc06
Compare
I've fixed the merge conflicts and rebased on to master. I've also renamed the flag to rustdoc +local src/lib.rs -Z unstable-options --crate-root-link Repo=https://a.com --crate-root-link "Web site"="https://a.com" |
After a discussion with the reviewer, they don't feel that it is a good idea to merge this at this point in time. If you wish you can find a better way we can tackle this problem. Closing this for now. Thanks for taking the time to contribute. |
Still remains the worry about those newly added links: basically, it's very easy to put whatever you want in there. Just imagine some crates adding ads or whatever, that would be pretty bad and I'm not sure we should allow it. What do you think @rust-lang/docs-rs ? |
The main places documentation shows up are
If you document it locally, I don't think we should care about where the link goes, if you want to show yourself ads then fine. Is there any concern you had about it other than ads? Otherwise I think this should be reopened. |
Oh and the third place is on a self-hosted documentation site, but if you've already gone to a random website I think that implies some level of trust (and you can put arbitrary links on your own site anyway). |
@@ -1,4 +1,4 @@ | |||
#!/usr/bin/env python | |||
#!/usr/bin/env python3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this change. There are systems that do not have python3 installed (#71818 (comment)). If you have trouble locally you can make a symbolic link from python3
to python
.
#!/usr/bin/env python3 | |
#!/usr/bin/env python |
@@ -406,6 +406,9 @@ fn opts() -> Vec<RustcOptGroup> { | |||
"specified the rustc-like binary to use as the test builder", | |||
) | |||
}), | |||
unstable("crate-root-link", |o| { | |||
o.optmulti("", "crate-root-link", "", "Specifies links to display on the crate root") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be optflag
and not optmulti
to make sure passing it in both cargo doc
and RUSTFLAGS
is an error.
This should implement everything needed in
rustc
to implement #72475 (although automatically adding links based onCargo.toml
would have to be implemented incargo-doc
). It allows an arbitrary links to be added to be added to the left sidebar. These are only displayed on the crate root.Sidebar links can be specified in two ways:
rustdoc src/lib.rs --sidebar-url Homepage=http://rust-lang.org --sidebar-url "Repository URL"="https://example.com/ a"
#[doc]
attribute:Screenshot
Notes
#[doc]
attributes are, and always have been silently ignored.#[doc]
attributes override commnad-line flags in the case of a disagreement.#[doc]
attributes override earlier#[doc]
attributes.#[doc]
attribute and command line config, it's unclear if it should be enabled by a seperaterustdoc
flag, or by a rustfeature
(I can't find any info on this).