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

Show feature labels in generated docs #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

davidpdrsn
Copy link

Checklist

  • I have read the Contributor Guide
  • I have read and agree to the Code of Conduct
  • I have added a description of my changes and why I'd like them included in the section below

Description of Changes

Adds #[cfg_attr(docsrs, doc(cfg(any(feature = "..."))))] to required features are highlighted in the standard rustdoc way.

Before:
Screen Shot 2022-01-11 at 09 58 55

After:
Screen Shot 2022-01-11 at 10 08 01

Related Issues

None.

@davidpdrsn davidpdrsn added the documentation Improvements or additions to documentation label Jan 11, 2022
@davidpdrsn davidpdrsn requested a review from emilk January 11, 2022 09:11
@davidpdrsn
Copy link
Author

To test this locally you have to generate the docs with RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features tokio --open.

Copy link
Collaborator

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa, didn't know about this. Very nice!

@repi
Copy link

repi commented Jan 11, 2022

Thought this wasn't needed anymore, that docs.rs had implemented support for the ordinary cfg? or maybe that is still support in progress, no sure.

@davidpdrsn
Copy link
Author

Thought this wasn't needed anymore, that docs.rs had implemented support for the ordinary cfg? or maybe that is still support in progress, no sure.

I don't know exactly what the state of things is but the labels aren't showing currently.

@emilk
Copy link
Collaborator

emilk commented Oct 24, 2022

I tried this with cargo doc --open --no-deps --features tokio but don't see the new docs:

Screen Shot 2022-10-24 at 12 24 42

@repi
Copy link

repi commented Oct 24, 2022

maybe it is only with nightly rustdoc? believe docs.rs does run nightly

@emilk
Copy link
Collaborator

emilk commented Oct 24, 2022

To test this locally you have to generate the docs with RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features tokio --open.

Maybe I should have read that 🤦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants