Skip to content

Show feature labels in generated docs#3

Open
davidpdrsn wants to merge 2 commits into
mainfrom
rustdoc-feature-tags
Open

Show feature labels in generated docs#3
davidpdrsn wants to merge 2 commits into
mainfrom
rustdoc-feature-tags

Conversation

@davidpdrsn

Copy link
Copy Markdown

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
davidpdrsn requested a review from hrydgard as a code owner January 11, 2022 09:11
@davidpdrsn

Copy link
Copy Markdown
Author

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

@emilk emilk left a comment

Copy link
Copy Markdown
Collaborator

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

repi commented Jan 11, 2022

Copy link
Copy Markdown

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
Copy Markdown
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

emilk commented Oct 24, 2022

Copy link
Copy Markdown
Collaborator

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

repi commented Oct 24, 2022

Copy link
Copy Markdown

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

@emilk

emilk commented Oct 24, 2022

Copy link
Copy Markdown
Collaborator

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