Skip to content
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

rustdoc: Please process top-level README by default #76966

Open
ijackson opened this issue Sep 20, 2020 · 8 comments
Open

rustdoc: Please process top-level README by default #76966

ijackson opened this issue Sep 20, 2020 · 8 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@ijackson
Copy link
Contributor

ijackson commented Sep 20, 2020

gitlab and crates.io both like to render the toplevel README (normally for a Rust crate, README.md). rustdoc formats crate-level documentation in src/lib.rs.

The result is that for many crates, the README contains very useful documentation not replicated in the rustdoc. For example, an introduction, or usage notes.

But, anomalously, that information is not shown at docs.rs and nor is included in rustdoc output.

This is confusing, because it means that when browsing crates online, the link in crates.io to "documentation" goes to a site which somehow doesn't have the documentation one was just looking at!

And it is a serious nuisance if one is using cargo doc to generate a documentation set for working offline: the resulting documentation is missing important parts.

I found #44732 and #66249 which seem to be related. In this issue I'm asking that README.md should be processed by default, and put somewhere prominent in the rustdoc output.

@jyn514
Copy link
Member

jyn514 commented Sep 20, 2020

that information is not shown at docs.rs

It's shown on the /crate page (which I understand no one visits).

@jyn514 jyn514 added C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Sep 20, 2020
@ijackson
Copy link
Contributor Author

ijackson commented Sep 20, 2020 via email

@jyn514
Copy link
Member

jyn514 commented Sep 20, 2020

The readme for that crate is shown here: https://docs.rs/crate/ambassador/0.2.1

@jyn514
Copy link
Member

jyn514 commented Sep 20, 2020

Is the page you are referring to generated by rustdoc or by docs.rs ?

It's generated by docs.rs, not rustdoc.

@ijackson
Copy link
Contributor Author

ijackson commented Sep 20, 2020 via email

@peterjoel
Copy link
Contributor

I would like to do something like:

#![doc(path = "../README.md")]

@jyn514
Copy link
Member

jyn514 commented Dec 13, 2020

@peterjoel on nightly you can use doc = include_str!("README.md"): #78835

@peterjoel
Copy link
Contributor

@jyn514 Thanks! I hadn't seen that RFC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants