Skip to content

rustdoc: fold fields for enum struct variants into a docblock #37728

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

Merged
merged 1 commit into from
Nov 13, 2016

Conversation

QuietMisdreavus
Copy link
Member

Per discussion in #37500, this PR updates the enum rendering code to wrap variants with named struct fields in a docblock span that is hidden automatically upon load of the page. This gives struct variant fields a clean separation from other enum variants, giving a boost to the readability of such documentation. Preview output is available on the issue page, but for the sake of completeness I'll include the images here again.

rustdoc struct enum variant 4 part 1

When you initially load the page, there's a line under variants with struct fields letting you know you can click to expand the listing.

rustdoc struct enum variant 4 part 2

If you click to expand, the header and table unfold into a nicely-indented listing.

If you want to take a look in your own browser and screen size, I've got this version hosted on my server.

Fixes #37500

r? @GuillaumeGomez

@frewsxcv
Copy link
Member

/build/src/librustdoc/html/render.rs:2473: line longer than 100 chars
/build/src/librustdoc/html/static/main.js:1022: line longer than 100 chars

@GuillaumeGomez
Copy link
Member

Please squash your commits then let's merge this!

@QuietMisdreavus
Copy link
Member Author

Ready to roll!

@GuillaumeGomez
Copy link
Member

@QuietMisdreavus: Thanks!

@bors: r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 12, 2016

📌 Commit fff9216 has been approved by GuillaumeGomez

@bors
Copy link
Collaborator

bors commented Nov 13, 2016

⌛ Testing commit fff9216 with merge b6b98ea...

bors added a commit that referenced this pull request Nov 13, 2016
…meGomez

rustdoc: fold fields for enum struct variants into a docblock

Per discussion in #37500, this PR updates the enum rendering code to wrap variants with named struct fields in a `docblock` span that is hidden automatically upon load of the page. This gives struct variant fields a clean separation from other enum variants, giving a boost to the readability of such documentation. Preview output is available [on the issue page](#37500 (comment)), but for the sake of completeness I'll include the images here again.

![rustdoc struct enum variant 4 part 1](https://cloud.githubusercontent.com/assets/5217170/20231925/96160b7e-a82a-11e6-945b-bbba95c5e4bc.PNG)

When you initially load the page, there's a line under variants with struct fields letting you know you can click to expand the listing.

![rustdoc struct enum variant 4 part 2](https://cloud.githubusercontent.com/assets/3050060/20232067/1dc63266-a866-11e6-9555-8fb1c8afdcec.png)

If you click to expand, the header and table unfold into a nicely-indented listing.

If you want to take a look in your own browser and screen size, [I've got this version hosted on my server](https://shiva.icesoldier.me/doctest/doctest/enum.OldTopicRemoval.html).

Fixes #37500

r? @GuillaumeGomez
@bors bors merged commit fff9216 into rust-lang:master Nov 13, 2016
@QuietMisdreavus QuietMisdreavus deleted the rustdoc-enum-struct branch November 14, 2016 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants