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

More meaningful docs on docs.rs #207

Closed
dtolnay opened this issue Oct 10, 2022 · 2 comments · Fixed by #209
Closed

More meaningful docs on docs.rs #207

dtolnay opened this issue Oct 10, 2022 · 2 comments · Fixed by #209
Assignees
Milestone

Comments

@dtolnay
Copy link

dtolnay commented Oct 10, 2022

I saw that derive_more has been doing its own thing on jeltef.github.io since at least March 2021, and the docs at https://docs.rs/derive_more/0.99.17 do not include any of the content from https://github.com/JelteF/derive_more/tree/v0.99.17/doc.

Since Rust 1.54 (July 2021) rustdoc knows how to include external markdown files as docs. See https://blog.rust-lang.org/2021/07/29/Rust-1.54.0.html#attributes-can-invoke-function-like-macros. Could you consider whether this means the bespoke website can be dropped in favor of docs.rs at this point?

@JelteF
Copy link
Owner

JelteF commented Oct 10, 2022

I'm still waiting for this issue to be addressed: rust-lang/cargo#739

The link you shared seems interesting, but not very useful to the problem I had: rustdoc needs some Rust item to attach the docs to, e.g. a trait. But because these are only derives, for traits that I don't own, I was unable to attach them anywhere.

It's definitely been a 3+ years since I looked into this though. So if you know some useful trick, I'd love to know about it. I definitely would like to have the docs fully on docs.rs

@dtolnay
Copy link
Author

dtolnay commented Oct 10, 2022

rustdoc needs some Rust item to attach the docs to

Derive macros are items. Rustdoc puts them in the rendered documentation, the only reason they're not there for derive_more is this crate has intentionally hidden them.

#[doc(hidden)]

The way I would expect the documentation for this crate to be arranged, after that hidden is removed, is like this:

Screenshot from 2022-10-09 17-29-06
Screenshot from 2022-10-09 17-29-21

@JelteF JelteF closed this as completed Oct 10, 2022
@JelteF JelteF reopened this Oct 10, 2022
@tyranron tyranron self-assigned this Oct 13, 2022
@tyranron tyranron added this to the 1.0.0 milestone Oct 13, 2022
tyranron added a commit that referenced this issue Oct 18, 2022
- embed external docs via `#[doc = include_str!(...)]`
- preserve `README.md` links working on GitHub
- switch doc tests to 2021 Rust edition and fix formatting problems
- use `feature(doc_auto_cfg)` for badges on `docs.rs`
- remove redundant toolchain regarding Rust docs generation from external files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants