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

rustdoc: proposal to tame gutter affordances #57164

Open
JohnHeitmann opened this issue Dec 28, 2018 · 2 comments
Open

rustdoc: proposal to tame gutter affordances #57164

JohnHeitmann opened this issue Dec 28, 2018 · 2 comments
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@JohnHeitmann
Copy link
Contributor

JohnHeitmann commented Dec 28, 2018

I have a few small proposals to reduce the visual clutter of rustdoc pages:

  1. Move all toggle buttons to the right. Benefits: consistency (sometimes they are already on the right), and moves element clutter to a part of the page that doesn't have the reader's initial focus.
  2. Similarly, move the ⓘ link to the right.
  3. On the following doc bits remove toggles completely and show docs unconditionally:
    1. Item description
    2. Enum variant
    3. Struct and trait method descriptions (methods directly on the item, not foreign)
  4. "Smart" disclosure of short declarations. If a declaration is at most a few lines long, show it unconditionally with no toggle. Ditto attributes in declarations. Long declarations like Iterator retain their current undisclosed behavior.
    1. ... alternately: always show ~4 lines and truncate beyond that with ...
  5. On mobile: be a bit more extreme in clutter reduction and remove completely any toggles that default to open.
  6. On mobile: for blocks that do have a closed toggle, do not wrap the exposed heading, instead truncate with "..." before the toggle. I think declarations tend to have enough information leftward to make this work well, but I haven't tried it yet. It might be a horrible idea in practice.

Quick 'n Dirty mockups just to give the gist:

screen shot 2018-12-27 at 11 27 41 pm

screen shot 2018-12-27 at 11 27 18 pm

The size and indentation of the toggles as they are implemented today do give some ambient hints about the hierarchy of the page, so I'd also want to tweak spacing & sizing a bit to better emphasize hierarchy. You can see in the mock (where I haven't tweaked spacing yet) that the pub fn line looks very similar in priority to the impl Vec line, which is probably not desirable.

Bonus Objectives:

  1. A better icon for ⓘ that more closely indicates what it is.
  2. Remove or tweak ⓘ where it doesn't seem to add value. e.g. nearly every method on Vec: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.new . I'm pretty ignorant about this feature. Maybe I'll come around on it once I understand it better.

If this gets positive reception, I can build a demo of these changes.

@JohnHeitmann
Copy link
Contributor Author

One more tweak proposal: Change the text "fields omitted" to either "private fields omitted" or nothing at all in order to distinguish between the "These are private" case and the "We're hiding these for decluttering" case. Until just now I thought that text was for decluttering.

@Centril Centril added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Dec 28, 2018
@steveklabnik
Copy link
Member

cc @GuillaumeGomez

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants