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

Add API documentation front page styleguide #1687

Closed
wants to merge 26 commits into from

Conversation

sophiajt
Copy link
Contributor

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.

@BurntSushi
Copy link
Member

Rendered.

>
> 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
Copy link
Member

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.

@alexcrichton
Copy link
Member

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
Copy link
Member

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.

@mdinger
Copy link
Contributor

mdinger commented Jul 26, 2016

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).

@nrc
Copy link
Member

nrc commented Jul 26, 2016

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.

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.

@nrc nrc added the T-libs-api Relevant to the library API team, which will review and decide on the RFC. label Jul 26, 2016
@mdinger
Copy link
Contributor

mdinger commented Jul 27, 2016

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
Copy link

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

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Jul 27, 2016

About the README overlaps, IMO, it's normal. The only differences should be:

  • Dependencies of the crate.
  • How to build this crate.
  • Links to CIs status.

These things shouldn't be in the doc and should remain in the README file.

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:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/'rand'/rand

Copy link

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.

@Havvy
Copy link
Contributor

Havvy commented Aug 5, 2016

Do these guidelines actually necessitate changing any crates to match the guidelines?

@alexcrichton alexcrichton added T-doc Relevant to the documentation team, which will review and decide on the RFC. and removed T-libs-api Relevant to the library API team, which will review and decide on the RFC. labels Aug 15, 2016
peschkaj and others added 2 commits August 19, 2016 15:42
* Corrects typos in RFC.
* Normalizes use of `rand` instead of rand.
@matklad
Copy link
Member

matklad commented Aug 29, 2016

I also find it useful when a landing page of the API docs contains links to source code repository and the crates.iopackage.

Right now, for example, it is impossible to discover github repository of the log using only https://doc.rust-lang.org/log/log/index.html.

@frewsxcv
Copy link
Member

I also find it useful when a landing page of the API docs contains links to source code repository and the crates.io package.

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 repository value in 'Cargo.toml' and putting somewhere in the generated documentation?

@aturon
Copy link
Member

aturon commented Jan 31, 2017

Ping on this RFC -- what's the status?

@aturon
Copy link
Member

aturon commented Jan 31, 2017

cc @brson @rust-lang/libs

@sophiajt
Copy link
Contributor Author

@aturon - got distracted onto other things. I'll see if I can find the notes on what needed to be revised...

@aturon
Copy link
Member

aturon commented Apr 26, 2017

@jonathandturner Checking in again on this -- relevant to the libs team work. cc @dtolnay as well.

@dtolnay
Copy link
Member

dtolnay commented May 8, 2017

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.

@sophiajt
Copy link
Contributor Author

sophiajt commented May 8, 2017

@dtolnay - invited! BTW, feel free to pull me into discussions on it. I'm glad someone's taking this and running with it 😄

@dtolnay
Copy link
Member

dtolnay commented May 8, 2017

I have updated the RFC to address the feedback so far and add my own experience. Rendered

  • I clarified the purpose of the introduction using an approach that I have found helpful in writing to-the-point introductions in the past. I think this concrete advice will be more valuable than something hand-wavy and obvious like "the what and the why of the crate."
  • I combined the capabilities and examples sections but with a note that examples may live under each capability or all together in an Examples section. In my experience neither of these approaches works well for every crate.
  • I would like this RFC to clarify the relationship between the rustdoc front page and the project's readme. I made a list of some things that have traditionally gone in the readme but not the front page doc, and some projects that have readmes/doc of varying levels of similarity.
  • I added lots of alternative ideas.
  • I added lots of unresolved questions.

@QuietMisdreavus
Copy link
Member

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:

  • "How to add this library to your project" boilerplate. Each crate I have that's published, I have a little toml blurb and extern crate line in the README that shows how to add that crate to a rust project. I leave these out of the generated documentation, though, because in the context of "what does this library do" those lines are just noise.
  • Description of the examples/ directory, or anything specific to the layout of the repository itself. I may link to the repository from the crate-root documentation, but I haven't actually said "In examples/tweet.rs you can see several of these methods being used" because I haven't wanted to create those links in a place that's likely to grow stale if I update the example code or the layout of that directory itself.

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.

@aturon
Copy link
Member

aturon commented Sep 6, 2017

Bump on this -- can we drive to a resolution?

@steveklabnik
Copy link
Member

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

@dtolnay
Copy link
Member

dtolnay commented Sep 6, 2017

I don't think I have bandwidth for this in the next 2 weeks before the impl period.

@steveklabnik
Copy link
Member

@dtolnay is postponing maybe the right choice then?

@steveklabnik
Copy link
Member

@rfcbot postpone

Given @dtolnay 's comment above, and that this would need revisions based on other non-accepted RFCs, I suggest we postpone this till next year.

@dtolnay
Copy link
Member

dtolnay commented Sep 6, 2017

@rfcbot fcp postpone

1 similar comment
@steveklabnik
Copy link
Member

@rfcbot fcp postpone

@rfcbot rfcbot added the proposed-final-comment-period Currently awaiting signoff of all team members in order to enter the final comment period. label Sep 6, 2017
@rfcbot
Copy link
Collaborator

rfcbot commented Sep 6, 2017

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.

@steveklabnik
Copy link
Member

Checking off @jonathandturner since he's not on the team anymore; should update @rfcbot !

@QuietMisdreavus
Copy link
Member

@rfcbot reviewed

1 similar comment
@frewsxcv
Copy link
Member

frewsxcv commented Sep 7, 2017

@rfcbot reviewed

@aturon
Copy link
Member

aturon commented Sep 20, 2017

I'm going to go ahead and close this out as postponed, since the impl period has started. Thanks all!

@aturon aturon closed this Sep 20, 2017
@rfcbot rfcbot removed the proposed-final-comment-period Currently awaiting signoff of all team members in order to enter the final comment period. label Sep 20, 2017
@kbknapp kbknapp mentioned this pull request Dec 7, 2017
57 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-doc Relevant to the documentation team, which will review and decide on the RFC.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet