-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add API documentation front page styleguide #1687
Conversation
> | ||
> If no logging implementation is selected, the facade falls back to a "noop" implementation | ||
> that ignores all log messages. The overhead in this case is very small - just an integer load, | ||
> comparison and jump. > > A log request consists of a target, a level, and a body. A target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple newlines got chomped here.
I think @sfackler's comment here is actually an interesting one when taken more broadly as well. In terms of the "front page" of a crate, should we conventionally put more efforts into READMEs or crate documentation? A README tends to actually be the first thing you read when hitting a crate (e.g. looking at the source on GitHub), and only afterwards might you go look at the documentation. That being said I'd personally prefer to put all documentation into the crate as it reduces duplication and it should "live with the code". Perhaps though discussion about this may be appropriate for this RFC? |
|
||
This RFC is a companion to the [API doc guidelines proposal] | ||
(https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md). | ||
In this RFC, we focus on the format and style of the "front page" of an API. The goal of this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean front page of documentation as generated by rustdoc? “API” is a function or a set of functions exposed to other programmers and the acronym is in no way related to presentation.
When someone links to the docs, there often isn't a link back to the repo or the crate which isn't really nice. This can be manually added but often isn't. It could be added as a convention. Alternatively, maybe a shield could be added for the crate and repository or something. It seems like something which would probably be easy to include in rustdoc (not quite sure but it seems like it). |
If we make that a convention or shield, could we do the same for a link to crates.io, I also often want that from a docs page. |
That's actually what I meant by crate but yeah, that'd be cool. |
## Introduction text to the crate | ||
|
||
The first thing potential users of your crates will see is the introductory summary. This section is | ||
a good place to introduce the what and the why the crate. A good introduction is concise but also |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/why the/why of the
About the
These things shouldn't be in the doc and should remain in the |
It's helpful to introduce and give a clear description for each capability separately to help your | ||
readers understand each concept individually before they begin to combine capabilities. | ||
|
||
Here's a good example from the 'rand' crate: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/'rand'/rand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be a link. When mentioning the log crate above you make it a link. I don't think a link has been provided for rand yet despite multiple mentions.
Do these guidelines actually necessitate changing any crates to match the guidelines? |
* Corrects typos in RFC. * Normalizes use of `rand` instead of rand.
Cleans up links and formatting.
I also find it useful when a landing page of the API docs contains links to source code repository and the Right now, for example, it is impossible to discover github repository of the |
I also see the value in adding a link to the source repository from the API documentation. This is tangential, but couldn't this be done automatically by retrieving the |
Ping on this RFC -- what's the status? |
cc @brson @rust-lang/libs |
@aturon - got distracted onto other things. I'll see if I can find the notes on what needed to be revised... |
@jonathandturner Checking in again on this -- relevant to the libs team work. cc @dtolnay as well. |
Hey @jonathandturner, could I get push access to your fork for the duration of this RFC? That way we can keep all the discussion in one PR. |
@dtolnay - invited! BTW, feel free to pull me into discussions on it. I'm glad someone's taking this and running with it 😄 |
I have updated the RFC to address the feedback so far and add my own experience. Rendered
|
So, when talking with the docs team about it, we generally like what's going on here, but we're not entirely sure how to address the unresolved question of what's actually different between a crate's front matter and its README. I'll just add my own experience here. Here's what I put in a README that doesn't necessarily go in the front matter, in addition to the items already listed:
If I were to apply a generalization to these things and the things already listed in the RFC, I might consider "Things that apply solely or primarily to the source code or the layout of the repo belong in the README." The "how to use this" boilerplate would fall under an additional "background knowledge" provision, since I personally would consider that knowledge to be out of scope for the a specific library's documentation. |
Bump on this -- can we drive to a resolution? |
I am going to re-read this and related RFCs soon; some of the other ones may change the way this RFC should work, especially things like #1990 |
I don't think I have bandwidth for this in the next 2 weeks before the impl period. |
@dtolnay is postponing maybe the right choice then? |
@rfcbot fcp postpone |
1 similar comment
@rfcbot fcp postpone |
Team member @steveklabnik has proposed to postpone this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Checking off @jonathandturner since he's not on the team anymore; should update @rfcbot ! |
@rfcbot reviewed |
1 similar comment
@rfcbot reviewed |
I'm going to go ahead and close this out as postponed, since the impl period has started. Thanks all! |
This adds a proposal for the API documentation front page (the front matter you see when you first look at a crate's documentation). This is intended specifically for rust-lang crates, but works as suggested guidelines for any crate authors.