-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Link to corresponding sections for enum variants in rustdoc #75178
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
Conversation
Some changes occurred in HTML/CSS/JS. Some changes occurred in HTML/CSS themes. A change occurred in the Ayu theme. cc @Cldfire |
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @GuillaumeGomez (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. |
As far as the colors go, I played around with the blues a bit and came up with:
They all have good contrast for their respective backgrounds and fit in well with the surrounding colors. Something else I noticed was that in the light and dark themes, we went from: to, after this PR: ( |
I'm not a big fan of adding link in code blocks nor adding extra colors to the fields description (I don't mind adding colors in the type code block though). |
@RDambrosio016: I think that's only for private fields/structs. For example, rustc_infer::traits::Obligation shows all of the fields. I think it would be useful to generate links for structs as well. @GuillaumeGomez: I think links in code blocks are very useful, especially for larger enums. For example, having links on rustc_hir::ExprKind would make it much easier to read the description for any particular variant. |
You already have all the links in the sidebar. |
@GuillaumeGomez: Personally, I find it easier to read through the code block enum declaration, rather than looking at the sidebar. Types used in codeblocks already have links - is there any harm in adding more? |
Which types in codeblocks already have links? Also, I said I don't like it but if people are in favor, then we'll merge it, don't worry. ;) |
@GuillaumeGomez: Any type used in a codeblock (other than a plain generic parameter |
This is a good argument. |
Ok, I've been thinking about it for a while, and here's my conclusion: this is a good idea. However, we should also do it for all types with fields (as long as we provide a section for the fields). What do you think? Otherwise, great work here! |
It has been decided this feature should be expanded to be more expansive, and it should be incrementally implemented, therefore i will be closing this PR and opening a tracking issue. Then incrementally opening PRs to add this. |
resolves #74849 (for structs rustdoc shows fields omitted, so i am not sure if that should be removed and replaced for this)
This makes the text for each variant in an enum declaration a link to their corresponding section. As for the color that must be decided, i am by no means a design expert, i chose the color used for statics since it looked nice and not overbearing. But if you have an idea for a better color feel free to comment!
@Aaron1011 For structs do you mean rustdoc should render fields as well with clickable links for the fields?
Example of the output on dark theme
