-
Notifications
You must be signed in to change notification settings - Fork 13k
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: Add stability and source links to the methods #13802
Conversation
…ng#12932. this change made most functions that render the methods to require the render `Context`, so they are now made into `Context` methods.
this makes a source link much more visible (and link-like), and makes a stability index more consistent for the top-level headings and the method signature. this should be better than nothing, but further adjustments and/or redesigns are welcomed.
Those source links are a bit glaring. I prefer the style seen by [src] links in the existing rustdoc (though I definitely approve of putting them on every item). You might also consider only showing them on hover, just to keep the visual clutter down. I also think the stability annotations need some tweaking. I would suggest putting a little more space to the left, and perhaps ditching the underline in favor of e.g. [deprecated]. Also possibly drop the font size by a point or two. |
I agree that the current layout is not that good (and that in general I suck at design ;), but it should be handled separately (there are lots of other issues in the rustdoc layout, I've noted some of them in #13804). My original intention is as follows:
|
The implementation here looks great to me, nice work! I think the only question here is style. I do agree that there's room for improvement. Perhaps some of the smaller things could be knocked out as part of this PR as well? |
Do the stability attributes show their text yet? e.g. #[deprecated="use `bar`"]
pub fn foo() {}
#[experimental="use `foo`"]
pub fn bar() {} (If you'll excuse my crappy library design ;P ) |
@alexcrichton What do you mean by smaller things? Something like #13804? (I'm totally willing to fix them, I wanted to make sure if that should be included in this PR.) @huonw Not yet, except for the mouse-over title. Maybe "smaller things" can include that as well. |
Ah, by small things I mean some of @kballard's concerns. This looks ok to me, but I'm curious what @adrientetar thinks about it. Do you think there should be tweaks here and there to this? |
I will look at this. @lifthrasiir: do you have a sample page at hand? |
@adrientetar Sure, the current render as of 64d6178 is available at http://cosmic.mearie.org/2014/04/29-rustdoc/foo/struct.X.html. |
While implementing the explicit stability documentation (as @huonw noted), I've also experimented with the position of the stability index and documentation if any. The resulting render, available at http://cosmic.mearie.org/2014/04/29-rustdoc2/foo/struct.X.html, looks not very bad either: |
I don't like that. It's reducing information density even further, which is a bad idea given the current state of the documentation. I'm also concerned about how this will look when the functions actually have docstrings. I think the stability attribute should stay on the same line as the function signature. Perhaps the stability message could only show up when you hover over the attribute? (and put some indicator on the attribute to indicate that it has a hover). |
I'm working on this, will follow-up tomorrow. My working branch is adrientetar/lift-rustdoc. |
@adrientetar Thank you! I think you've already rebased my initial commits; should I close this issue in favor of #14042? |
@lifthrasiir Yes, otherwise it will close it when merged. |
…y, r=Veykril Add completion for function without body Fix rust-lang#13802
Fixes #12932. This also fixes a span for the provided methods (originally excluded the method body), and provides an initial stylesheet for updated stability and source links ("better than nothing", adjustment and/or redesign welcomed). The rustdoc renders now look like this: