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

Render cfg(feature) requirements in documentation #44994

Closed
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
@Nemo157
Contributor

Nemo157 commented Oct 3, 2017

Was based on #35903 when I implemented this almost a year ago, that's been closed since in favour of #1998, but since this is very much a special case for cfg(feature) I don't think it makes sense to update the issue id.

You can see the current output for diesel at https://nemo157.com/rustdoc-features-example/diesel-impl2/diesel/index.html, there is definitely some work on the HTML/CSS that needs to happen (e.g. the implementors section has some really bad alignment issues but getting some feedback on the general structure + ideas about nicer ways to render the details into the docs would be great.

Nemo157 added some commits Nov 24, 2016

Calculate cfg(feature) requirements
Adds a new rustdoc pass that pre-calculates the sets of features required for
different items so they can be rendered in the documentation.
wip: Render cfg(feature)
Render the features required for an item.

Fixes #35903
@rust-highfive

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Oct 3, 2017

Collaborator

Some changes occurred in HTML/CSS.

cc @GuillaumeGomez

Collaborator

rust-highfive commented Oct 3, 2017

Some changes occurred in HTML/CSS.

cc @GuillaumeGomez

@rust-highfive

This comment has been minimized.

Show comment
Hide comment
@rust-highfive

rust-highfive Oct 3, 2017

Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @frewsxcv (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.

Collaborator

rust-highfive commented Oct 3, 2017

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @frewsxcv (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.

@GuillaumeGomez

This comment has been minimized.

Show comment
Hide comment
@GuillaumeGomez

GuillaumeGomez Oct 3, 2017

Member
tidy error: /checkout/src/librustdoc/html/render.rs:2632: line longer than 100 chars

I'll take a look at the code when the tests pass.

Member

GuillaumeGomez commented Oct 3, 2017

tidy error: /checkout/src/librustdoc/html/render.rs:2632: line longer than 100 chars

I'll take a look at the code when the tests pass.

@@ -598,6 +598,19 @@ body.blur > :not(#help) {
top: 0;
}
.cfg-feature {
padding-left: 10px;
font-family: "Comic Sans MS", monospace;

This comment has been minimized.

@retep998

retep998 Oct 3, 2017

Member

Comic Sans MS
welp.

@retep998

retep998 Oct 3, 2017

Member

Comic Sans MS
welp.

@Nemo157

This comment has been minimized.

Show comment
Hide comment
@Nemo157

Nemo157 Oct 4, 2017

Contributor

Sorry about that, pushed a fix

Contributor

Nemo157 commented Oct 4, 2017

Sorry about that, pushed a fix

@kennytm

This comment has been minimized.

Show comment
Hide comment
@kennytm

kennytm Oct 5, 2017

Member

Is it possible to do this via #[doc(cfg)] instead? For example make #[cfg(feature = "x")] imply #[doc(cfg(feature = "x"))], and let the existing doc(cfg) code handle the rest (the rendering style would be different though).

Member

kennytm commented Oct 5, 2017

Is it possible to do this via #[doc(cfg)] instead? For example make #[cfg(feature = "x")] imply #[doc(cfg(feature = "x"))], and let the existing doc(cfg) code handle the rest (the rendering style would be different though).

@Nemo157

This comment has been minimized.

Show comment
Hide comment
@Nemo157

Nemo157 Oct 6, 2017

Contributor

@kennytm that would definitely help me avoid having to work out a nice rendering style :) I might try and see how that looks over the weekend

Contributor

Nemo157 commented Oct 6, 2017

@kennytm that would definitely help me avoid having to work out a nice rendering style :) I might try and see how that looks over the weekend

@frewsxcv frewsxcv assigned nrc and unassigned frewsxcv Oct 9, 2017

@bors

This comment has been minimized.

Show comment
Hide comment
@bors

bors Oct 13, 2017

Contributor

☔️ The latest upstream changes (presumably #45233) made this pull request unmergeable. Please resolve the merge conflicts.

Contributor

bors commented Oct 13, 2017

☔️ The latest upstream changes (presumably #45233) made this pull request unmergeable. Please resolve the merge conflicts.

@carols10cents

This comment has been minimized.

Show comment
Hide comment
@carols10cents

carols10cents Oct 16, 2017

Member

Friendly ping to keep this on your radar @Nemo157!

Member

carols10cents commented Oct 16, 2017

Friendly ping to keep this on your radar @Nemo157!

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Oct 19, 2017

Member

I'm going to close this now due to inactivity to help clear out the queue, but please feel free to resubmit with a rebase!

Member

alexcrichton commented Oct 19, 2017

I'm going to close this now due to inactivity to help clear out the queue, but please feel free to resubmit with a rebase!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment