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

Recommend best practices for package README.md files #2851

Closed
kwalrath opened this issue Jan 12, 2021 · 10 comments
Closed

Recommend best practices for package README.md files #2851

kwalrath opened this issue Jan 12, 2021 · 10 comments
Assignees
Labels
act.wait-for-customer Needs response from customer

Comments

@kwalrath
Copy link
Contributor

kwalrath commented Jan 12, 2021

Related: dart-archive/stagehand#683

Package READMEs often serve triple duty, as API homepages, pub.dev homepages, and repo homepages. For example, consider, the README for the shelf package (https://github.com/dart-lang/shelf/blob/master/README.md), which is rendered in the following places:

If you have examples of good READMEs (preferably with examples of WHY they're good, and HOW they could be even better) and issues related to READMEs, please comment on this issue.

https://github.com/thegooddocsproject/templates might be interested in what we come up with.

/cc @jayoung-lee

@kwalrath
Copy link
Contributor Author

kwalrath commented Jan 12, 2021

Maybe we can collect guidance in this comment. Here's a start.

Dart-specific guidance for READMEs:

  • If the package has associated UI, include a screenshot.
  • Use absolute URLs for links, images, etc., so that they'll work no matter where the README is published.

General guidance for READMEs (not Dart-specific):

@kwalrath kwalrath assigned kwalrath and filiph and unassigned kwalrath Jan 12, 2021
@filiph
Copy link
Contributor

filiph commented Jan 12, 2021

Additional guidance (totally optional):

  • spend some time on the short description at the top of the README. It should concisely describe what the package is about, at a glance.
  • screenshot is better than not, mov/gif is better than static image
  • screenshot above the line (visible close to the beginning of the README
  • use badges (CI/CD, coverage, etc.) to signal maintenance, stability
  • use code formatting (```dart, three backticks+dart)
    final like = "this";
    instead of
    final like = "this";
    
  • A short and sweet code sample in README is nice. Put a more complete example in example/example.dart. The one in README doesn't need to compile: it's there to explain.

We might consider writing a short article on pub.dev/ about this? Because then we can link to it from the README, and we can add visual aids:

ezgif-7-58f13f87c471

Some resources:

@jayoung-lee
Copy link
Contributor

I'd also suggest authors to:

  • start README with a short sentence that summarizes what the package can do
  • include a "Features" section that lists key features (preferably with bullet points)
  • include a "Parameters" section that lists available parameters, if applicable (preferably in tables)
  • include a "Getting started" or "How to use" section, which helps users quickly understand how to use the package
  • include at least one short code sample that users can quickly copy and paste to test how the package works

+1 to writing a short article on pub.dev! The article may include recent UX research insights on how Flutter/Dart users search for packages on pub.dev and consume README files there. I'd also like to add tips like:

  • make sure to add LICENSE information
  • make sure that the description in the pubspec.yaml file is up-to-date

@kwalrath
Copy link
Contributor Author

kwalrath commented Jan 14, 2021

@jayoung-lee said:

  • include a "Parameters" section that lists available parameters, if applicable (preferably in tables)

This sounds more detailed than I'm used to seeing in a README. Can you point me to an example of this? (Maybe the package API tends to reuse the same parameters in multiple places?)

@jayoung-lee
Copy link
Contributor

Then it's probably because some packages visited during the recent user study were simpler than others?

Participants visited few pages that listed parameters, attributes, or properties, and they found it useful when deciding whether to test the package or not.

@kwalrath
Copy link
Contributor Author

I took a quick look at those package pages plus the other places where their README.md is used. There are some issues with sharing the content, although not as many as I expected. Mostly the issues are with dartdoc rendering differently or not finding images because they had relative URLs. Interestingly, relative images worked on pub.dev/packages pages.

@kwalrath
Copy link
Contributor Author

To be clear... I believe that of the 3 README usages, the package page is most important. It's good that if the README works in the repo, it seems highly likely to work as a package page. I'm curious how many people look at the API docs on pub.dev.

@jayoung-lee
Copy link
Contributor

jayoung-lee commented Jan 15, 2021

I agree that the package page is most important!

It seems like very small number of pub.dev visitors (~5% of pageviews) open API docs (/documentation/**), compared to 72% of pageviews being to /packages/**.

@kwalrath
Copy link
Contributor Author

It seems like very small number of pub.dev visitors (~5% of pageviews) open API docs (/documentation/**), compared to 72% of pageviews being to /packages/**.

That's very good information to have! It's especially telling since there's only one URL for each package under /packages/, but multiple URLs under each package's /documentation/ path (even if you only consider /documentation/latest).

@parlough
Copy link
Member

We now have a great article covering this with #3147 which can be found at https://dart.dev/guides/libraries/writing-package-pages.

Thanks for the amazing work on this article, it's a great resource!

Closing this for now. If there are any other additions you'd like to see, we can discuss them in a targeted, follow-up issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
act.wait-for-customer Needs response from customer
Projects
None yet
Development

No branches or pull requests

4 participants