-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rust API doc style is sometimes confusing #17193
Comments
I agree this is a issue I'd like to see fixed. Related: #15642 |
The heading `Example` is distracting. I think we present the docs just as well without it. See issue rust-lang/rust#17193
The only thing I want from the docs at this point is to have an alphabetized list of all the function names at the top. To get a list of all function names, I can click the |
Thanks a lot ! @bluss - are you interested in taking this work further, do you think it's best to be finished by someone else ? |
@cyplo I haven't done anything for this in rust I think. I'd love to see any kind of improvement, feel free to work on it. |
Alrighty - I will take a look there and see what I can do to improve the docs in a way suggested here, to have the function names more easily browseable/scannable. Thanks ! |
It looks like the doc style has changed a fair amount since this issue was last touched. Would you still consider this a problem? Do we want to morph this into "add a method listing separate from the full doc listing" instead? |
I think the issue is still there. I just scrolled the std::vec::Vec page and the size and color of "Example" and panics are still catching my eyes, distracting from the methods. What's the issue with just chanigng the font size to be smaller than the actual function name? Example is wrapped within a Did you ever consider to collapse the examples? This may help to skim over a page to find the desired function. Examples can be shown by expanding the collapsed field. |
The doc text can be collapsed all at once with the This just shrinks the headings inside doc blocks a little. Is this sufficient, or are more tweaks necessary? |
The size of the heading vs the size of the code sample looks really really strange to me, though that may just be because I've stared at rustdoc's output so much. |
The problem with making it an (Also that |
My screenshot is probably not the best solution, I guess you will find a better one. All I want to say is that by now, Examples and Code are really distracting and functions are not highlighted enough. Maybe it's just that I'm used to Python, but Rust was by now the only language where I noticed that scrolling over the documentation in order to find a function is quite hard because there is IMO less/distracting optical structure compared to others. (see also screenshots in my first post) If I'm the only one that is affected by this, feel free to close the issue, I don't want to waste your development resources on CSS discussions. |
It's certainly worth fixing. crates itertools and ndarray don't use This is not just about examples, it's all headings, right? Common ones are Panics, Safety, Examples. I think shrinking those headings to current h3 size already is a big improvement -- we can try something like that? |
Here's a sample that shrinks There may need to be more finessing required if we don't want them to shrink on top-level docs, but for now i can sketch this out without much fuss. (EDIT: i don't consider small CSS changes to be a waste of time, because it's a relatively small amount of effort for a sizeable reward. Plus i'm just going through all the rustdoc issues at this point and wanted to make sure this was triaged properly. If i can close it in the process, then i still consider that a win!) |
I think this can still get better with more fine-tuning, but your suggestion is already a big improvement @QuietMisdreavus, thanks! |
Just to get a sketch together, I've rendered a set of std docs at https://tonberry.quietmisdreavus.net/std-17193/std/index.html - I split out the CSS rules to make sure that headings in the topmost docs are the same as now, but headings elsewhere (under methods, traits, impls, etc) get shrunken to the size in that screenshot. Expanding the function-signature headings is another easy change, if you'd like that too. |
I just opened #43602 with this CSS change. |
…r=GuillaumeGomez rustdoc: shrink headings in non-top-level docblocks Headings in per-method docs are often bigger than the function names/signatures themselves, so this tones those down to accentuate the methods. ![screenshot of this change on Vec::swap_remove](https://user-images.githubusercontent.com/5217170/28849380-6116a830-76dc-11e7-8ce2-04433d09463a.png) Fixes #17193
While browsing the API documentation today, I found out that it's really hard to find a specific information with just scrolling the page.
For example, try to find
fn last
in the Vec documentation by just scrolling the page. This is really hard because of all the "Example"s written in bigger letters catching the eye. A little picture for those who don't want to try:In comparison, try to find
math.sqrt()
in the Python math documentation by just scrolling the page. To me, this seems easier because of the clear highlighting of the function names and the indentation of the explanations. (Don't get me wrong, the python documentation isn't perfect, too)This issue is not really big, but programmers are humans and they're often in a hurry. A clearer structure/design of the API documentation would improve readability and help people looking for specific features without knowing the precise function name in Rust.
The text was updated successfully, but these errors were encountered: