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

Reorganize documentation #1759

Closed
JelleZijlstra opened this issue Oct 9, 2020 · 18 comments · Fixed by #2174
Closed

Reorganize documentation #1759

JelleZijlstra opened this issue Oct 9, 2020 · 18 comments · Fixed by #2174
Assignees
Labels
T: documentation Improvements to the docs (e.g. new topic, correction, etc) T: enhancement New feature or request

Comments

@JelleZijlstra
Copy link
Collaborator

I feel like the current documentation isn't very well organized. It has a lot of pages and it's not obvious where to document things like .gitignore support (#1734). Here's the sections we have right now:

Captura de Pantalla 2020-10-09 a la(s) 2 25 53 p  m

The line wrapping makes it hard to see individual sections, and a lot of them are about fairly minor issues.

Some ideas:

  • "Editor integrations", "Version control integration" and "GitHub Actions" should all go into an "Integrations" section
  • black-primer isn't really relevant to users (as opposed to developers), it can just be in "Contributing to Black"
  • pyproject.toml should be renamed to "Configuration" and also cover other ways of configuring Black, like gitignore files and command-line options
  • "Ignoring unmodified files" is all about an implementation detail. Maybe it should just go into the "Contributing" section.

Please comment if you have other ideas (or if you think I'm all wrong here and the current organization is fine).

@JelleZijlstra JelleZijlstra added the T: enhancement New feature or request label Oct 9, 2020
@ichard26 ichard26 added the T: documentation Improvements to the docs (e.g. new topic, correction, etc) label Oct 9, 2020
@J-Exodus
Copy link
Contributor

I tend to agree @JelleZijlstra. At a minimum, each section title should make it obvious to the reader what content is contained within that section.
Perhaps a better layout could fall under a more simple structure. Something such as:

  • Overview/Introduction
  • Installation
  • Configuration
  • Integration
  • Contribution/Development
  • Credits

Transferring to a structure like this should be relatively simple. A good starting point would be allocating all the current sections to one of the new section titles, and then collating those individual sections.

Just my ideas from what I've seen/read. Thanks.

@ichard26
Copy link
Collaborator

ichard26 commented Feb 2, 2021

Okay, I'm picking this up after what seems like forever. Apologies for sorta causing this mess in the first place, I didn't really think through what I was doing last time I reorganized the docs. Now it's time for me to fix my mistakes and do it right.

So, I like @J-Exodus's basic structure and I'll be working on transferring our docs to it. I'll post a draft PR when ready.

@ichard26
Copy link
Collaborator

ichard26 commented Feb 2, 2021

This is the hierarchy I've been thinking about (WARNING: IT WILL CHANGE AS I EDIT) :

Overview

Getting Started (covers installation, basic usage, and next steps)

Usage and Configuration
  - The basics
  - Automatic file discovery
  - Controlling formatting 
  - Writeback and reporting
  - Black's API
  - Black as a server

The Black Code Style
  -  The Black code style
  - The (future of the) Black code style

Integrations
  - GitHub Actions
  - Source version control
  - Editors

Common Issues and FAQ (hi E203, I hate you so much)

Guides
  - Using Black with other tools
  - Introducing Black to your project 

Contributing 
  - The basics
  - Linting and testing
  - Documentation
  - Gauging changes (covers black-primer, gallery, and maybe performance testing one day)
  - Developer Reference

Maintenance (content for core team members and core team duties)
  - Traiging
  - Reviewing
  - Publishing

Change Log
Authors

Credits

suggestions and feedback are highly appreciated.

Edit history
  1. Added "The Black Style" top level section with "Current" and "Planned" subheaders (2nd of February, 2021)
  2. Added a subsection about configuring Black using a file or the command line interface (2nd of February, 2021)
  3. Added a subsection under "Development" bringing back the developer reference (2nd of February, 2021)
  4. Added a subsection under "Getting Started" about the (tiny and technically unofficial) API (2nd of February, 2021)
  5. Made significant changes to the "Getting Started" and "Configuration" sections, the latter was renamed to "Usage and Configuration" (2nd of February, 2021)
  6. Added a subsection under "Usage and Configuration" for blackd; removal of an useless and dumb "Misc." subsection under "Usage and Configuration"; and renamed "Running Black" under "Getting Started" to "Basic usage" (2nd of February, 2021)
  7. Added "Common Errors and FAQ" top level section (2nd of February, 2021)
  8. Renamed that new top level section to "Command Issues and FAQ" (2nd of February, 2021)
  9. Renamed "Gauging Style Changes" under "Development" to "Gauging Changes" (2nd of February, 2021)
  10. Simplified the "Getting Started" from a multi-page section into a single-page section; moved some content into a new multi-page section called "Guides"; moved some maintainer specific content from "Development" into a new multi-page section called "Maintenance"; removed rather dumb "CLI / Configuartion files" subsection under "Usage and Configuration"; and various renames and spaced out the hierarchy representation to look better :D (6th of February, 2021)
  11. Various name improvements (6th of February, 2021)
  12. A name improvement; got rid the very useless "Creating Issues" subsection under "Development"; and combined the "Linting" and "Testing and Fuzzing" subsections into "Linting and Testing" subsection under "Development". (6th of March, 2021)
  13. Added "The Basics" subsection under "Usage and Configuration" to have a place for the basics of running and configuring Black (eg. --version and pyproject.toml); and a slight reorder of the "Development" section (6th of March, 2021)
  14. Various name improvements (7th of March, 2021)
  15. Various renames to reflect actual names on the local branch; and also removed the probably unnecessary "Submitting a Pull Request" subsection while added a "Authors" section. (20th of April, 2021)

p.s. I suck at naming things so those section names are up for debate

@JelleZijlstra
Copy link
Collaborator Author

@ichard26 that sounds great!

@ichard26
Copy link
Collaborator

ichard26 commented Feb 6, 2021

@cooperlees @zsol what do you two think of the general hierarchy I've laid down above? I want do this correctly this time :)

@cooperlees
Copy link
Collaborator

I like it. I would personally start explaining the "Black Style"

  • Also in "Getting Started" I'd love a "Quick Start":
    • pip install black
    • black /path/to/files

@ichard26
Copy link
Collaborator

ichard26 commented Feb 7, 2021

I would personally start explaining the "Black Style"

Do you mean 'start by explaining the "Black Style"' (i.e. move it up) or do you mean we should start justifying why the style is like how it is? (While our style docs are outdated and need some updating, I think they do a decent job at justifying the style choices)

  • Also in "Getting Started" I'd love a "Quick Start":
    • pip install black
    • black /path/to/files

I thought it was implied that pip install black and black /path/to/files are covered via the "covers installation, basic usage, and next steps" detail, no?

Perhaps the "Usage and Configuration" section should be called "Advanced Usage and Configuration"?

@cooperlees
Copy link
Collaborator

I would personally start explaining the "Black Style"

Do you mean 'start by explaining the "Black Style"' (i.e. move it up) or do you mean we should start justifying why the style is like how it is? (While our style docs are outdated and need some updating, I think they do a decent job at justifying the style choices)

After the "quick start" go straight into explaining the "Black Style" as it's a great source of question / debate etc. etc.

  • I'm a big believer in hitting the hot spots as early as possible in docs.
  • Also in "Getting Started" I'd love a "Quick Start":

    • pip install black
    • black /path/to/files

I thought it was implied that pip install black and black /path/to/files are covered via the "covers installation, basic usage, and next steps" detail, no?

Yes - But I just wanted to emphasize that we keep a quick start. I personally dislike projects I have to go digging for the "Quick Start"

@ichard26
Copy link
Collaborator

ichard26 commented Feb 7, 2021

I personally would like to keep the "Black Style" and "Getting Started" sections separated to some degree so would moving the "Black Style" section right after "Getting Started" be okay? I was also planning to add a direct link to the "Black Style" section in the "next steps" subheader, so this might be enough?

I was planning to keep "Getting Started" tiny as a single page topic, so I'm struggling to find a place for a "quick start". I guess maybe a small subheader in the "Getting Started" page in the beginning for like "Hey are you a regular user of Black and want to get started quickly? If so, please read the following section, and if not, please skip."

fyi, subsections denote whole files so that why "Getting Started" has zero children, it's intended to be single-paged.

edit: I didn't say this explicitly, but I agree with your feedback, just that I'm struggling to do this in a manner that feels right in the current plan. Thanks for your feedback!

@ichard26
Copy link
Collaborator

ichard26 commented Feb 7, 2021

actually putting the "Black Style" section after the "Overview" section might make more sense since it's crucial to know how Black is going to format your file when deciding to use the tool or not.

@cooperlees
Copy link
Collaborator

I want to keep and like the sections. Was just talking about moving. I don't care if you don't to be honest. Lets not make this harder than it needs to be. The fact you're working on this is great.

In the end, do what ever you think is right. No matter what you do there will always be another way with documentation and people can comment and do PRs if they feel strongly moving forward.

@ichard26
Copy link
Collaborator

ichard26 commented Feb 7, 2021

Well yeah I get that I can't organize the docs to be perfect for everyone, but you're giving feedback and I should try to incorporate it, especially as a fellow core team member :)

Apologies if my frustration with everything (IRL included) is showing through, I did not intend to brush off your feedback. I think putting some work into a draft then seeing if it reads well with how it's organized according the plan, and then iterating (while keeping your feedback in mind) would be best. You are right about a lack of attention to the organization of the content for users. My perspective is from a core team member and maintenance type of guy view point, so thanks for the reminding me to about the other group of readers :)

Lets not make this harder than it needs to be

I mean, I would much rather deal with issues in the planning and draft stages then in the production stage so you're not really making this harder

@felix-hilden
Copy link
Collaborator

I don't know about the Sphinx template being used here, and how .md is compared to .rst, but sectioning the documentation further could also be beneficial. What I mean is dividing the sections themselves into groups. Not clickable documents, but simply sections in the toc tree. For example:

sections

The proposed sections could be divided into:

  • Package
    • Overview
    • The Black Code Style
    • Change Log
  • Guide
    • Getting Started
    • Usage and Configuration
    • Integrations
    • Common Issues and FAQ
    • Using Black with other tools (or under some common title with "Introducing Black to your project" as originally)
    • Introducing Black to your project (or under some common title with "Using Black with other tools" as originally)
  • Development
    • Contributing
    • Maintenance
    • Credits

Another way of pointing out hotspots could be a kind of introductory paragraph on the home page. Maybe something like:

"The Black code style is described here. For dealing with common issues see FAQ."

And so on, you get the point. It could mirror the section division, but more verbosely so that the reader doesn't have to guess as much as to where everything is located. Though the proposed structure is very much an improvement! And if there are just a handful of things that you'd like to direct attention to, the paragraph needn't reference every single section.

But I see this has been worked on for quite a while now, so perhaps it would be best to introduce these separately if you decide they're worth doing. How's the reorganizing going?

@ichard26
Copy link
Collaborator

ichard26 commented Apr 6, 2021

How's the reorganizing going?

It's going fine, slow progress but going well. I've been working on and off on for a quite a while as my time is limited and my attention gets pulled to more interesting things. This is how the sidebar looks right now from the local branch right now:

Screenshot from 2021-04-06 18-02-22

but sectioning the documentation further could also be beneficial

Unfortunately for the TOC section titles, they IMO look horrible with the theme we have right now:
Screenshot from 2021-04-06 18-08-11

I was considering moving the documentation to another theme, like the RtD one or Furo (which handle TOC section titles in a decent way), but given that influences the project's branding, I wasn't looking forward to the discussion needed by that with the rest of the core team. Honestly felt easier to just ignore that debate and work on less controversial changes. Also the spacing between the untitled sections felt like a decent compromise anyway.

In general, I like my structure, although the fact the changelog is at the bottom does rub me in the wrong way. I tried to order the sections to most important to the least important. Users (which make up the biggest reader chunk) will need to know Black's style (especially if they are considering to adopt Black for their project!), then how to use Black is also vital, and so on. After that we have the contributors and core team which is way smaller, so that's why their content is lower.

While I like your idea to move the changelog up, I don't like your package section. It's not clear to me what such a section would be about. I'll look into the getting started set up you got, I was 50-50 on the "one super duper simple getting started document which is followed by a much more complete document" idea I've got going on. But like other than that, we decided on pretty much the same structure ahaha

Another way of pointing out hotspots could be a kind of introductory paragraph on the home page. Maybe something like:

👍

In general, thanks @felix-hilden for the feedback and ideas! I'll definitely take them into account if possible.

@felix-hilden
Copy link
Collaborator

Honestly, that tree looks so much cleaner even without section titles. And I agree, they do look horrible in the theme. Combined with the branding argument I don't think it's worth it to start chasing a different theme just for them. The RTD theme has the mobile user friendliness which I don't know how this theme handles, but that also feels minor.

I feel the same about the change log, but if it's not a good fit right at the top with Code Style, then I think down there is the place. I intended the Package section to be all about raw information and no tutorials, other sections then being more verbose in their explanations. But it is quite vague. And yeah that seems like the way to organise it so I'm not surprised that you came up with it as well 😅

Looking good already! Get that awesome documentation!

@ichard26
Copy link
Collaborator

ichard26 commented Apr 21, 2021

Status update (to both prove I'm actually going to finish this and also provide some context):

So far I got all of the content moved over to the new structure, which is the majority of the needed work.

Although there's still a bunch to do:

  • Rewrite the README, CONTRIBUTING.md, also the documentation landing page
  • Clean up and redo the configuration to use MyST-Parser
  • A bunch of tiny todos I littered while I worked:
    • fix broken markup since the move from MD to RST
    • make "Black" *ed* since I'm a forgetful monkey
    • check captialization of titles and headings
    • check links (relative vs absolute)
    • finish up my sloppy move to MyST
    • address warnings during build
  • Address ALL OF THE MERGE CONFLICTS (I'm certainly looking forward to this one ... /s)
  • Redo the commit history because it's a mess
  • Submit a PR and get feedback
  • Convince someone to press the green merge buttom :)
  • Bask in the glory of better documentation (nah I'm just kidding, I've already got other tasks planned once I am done with this)

edit:
note to self: look into this: executablebooks/MyST-Parser#358

@JelleZijlstra
Copy link
Collaborator Author

Thanks so much for all your work @ichard26!

@ichard26 ichard26 added this to In progress in Amazing documentation Apr 27, 2021
@ichard26
Copy link
Collaborator

ichard26 commented May 1, 2021

If anyone is subscribed to this issue for some reason: I got my PR up now: GH-2174. Go have a look and provide any sort of constructive feedback if you can! Thanks in advance.

Amazing documentation automation moved this from In progress to Done May 8, 2021
ichard26 added a commit that referenced this issue May 8, 2021
I know I know, this is the second reorganization of the docs. I'm not
saying the first one was bad or anything... but.. actually wait nah,
*it was bad*.

Anyway, welcome to probably my biggest commit. The main thing with this
reorganization was to introduce nesting to the documentation! Having
all of the docs be part of the main TOC was becoming too much. There
wasn't much room to expand either. Finally, the old setup required
a documentation generation step which was just annoying.

The goals of this reorganization was to:

1. Significantly restructure the docs to be discoverable and
   understandable

2. Add room for further docs (like guides or contributing docs)

3. Get rid of the doc generation step (it was slow and frustrating)

4. Unblock other improvements and also just make contributing to the
   docs easier

Another important change with this is that we are no longer using GitHub
as a documentation host. While GitHub does support Markdown based docs
actually pretty well, the lack of any features outside of GitHub Flavoured
Markdown is quite limiting. ReadTheDocs is just much better suited for
documentation. You can use reST, MyST, CommonMark, and all of their
great features like toctrees and admonitions.

Related to this change, we're adopting MyST as our flavour of Markdown.
MyST introduces neat syntax extensions to Markdown that pretty much
gives us the best of both worlds. The ease of use and simplicity of MD
and the flexibility and expressiveness of reST. Also recommonmark is
deprecated now. This switch was possible now we don't use GH as a docs
host. MyST docs have to be built to really be usable / pretty, so the MD
docs are going to look pretty bad on GH, but that's fine now!

Another thing that should be noted is that the README has been stripped
of most content since it was confusing. Users would read the README and
then think some feature or bug was fixed already and is available in a
release when in reality, they weren't. They were reading effectively
the latest docs without knowing.

See also: #1759

FYI: CommonMark is a rationalized version of Markdown syntax

--

Commit history before merge:

* Switch to MyST-Parser + doc config cleanup

  recommonmark is being deprecated in favour of MyST-Parser. This change
  is welcomed, especially since MyST-Parser has syntax extensions for the
  Commonmark standard. Effectively we get to use a language that's powerful
  and expressive like ReST, but get the simplicity of Markdown.

  The rest of this effort will be using some MyST features.

  This reorganization efforts aims to remove as much duplication as possible.
  The regeneration step once needed is gone, significantly simplifing our
  Sphinx documentation configuration.

* Tell pipenv we replaced recommonmark for MyST-Parser

  Also update `docs/requirements.txt`

* Delete all auto generated content
* Switch prettier for mdformat (plus a few plugins)

  **FYI: THIS WAS EFFECTIVELY REVERTED, SEE THIRD TO LAST COMMIT**

  prettier doesn't support MyST's syntax extensions which are going to be
  used in this reorganization effort so we have to switch formatter.

  Unfortanately mdformat's style is different from prettier's so time to
  reformat the whole repo too.

  We're excluding .github/ISSUE_TEMPLATE because I have no idea whether
  its changes are safe, so let's play it safe.

* Fix the heading levels in CHANGES.md + a link

  MyST-Parser / sphinx's linkcheck complains otherwise.

* Move reference docs into a docs/contributing dir

  They're for contributors of Black anyway. Also added a note in the
  summary document warning about the lack of attention the reference has
  been dealing with.

* Rewrite and setup the new landing page + main TOC

  - add some more detail about Black's beta status
  - add licensing info
  - add external links in the main TOC for GitHub, PyPI, and IRC
  - prepare main TOC for new structure

* Break out AUTHORS into its own file

  Not only was the AUTHORS list quite long, this makes it easy to include
  it in the Sphinx docs with just a simple symlink.

* Add license to docs via a simple include

  Yes the document is orphaned but it is linked to in the landing page
  (docs/index.rst).

* Add "The Black Code Style" section

  This mostly was a restructuring commit, there has been a few updates but
  not many. The main goal was to split "current style" and "planned
  changes to the style that haven't happened yet" to avoid confusion.

* Add "Getting Started" page

  This is basically a quick start + even more. This commit is certainly
  one of most creatively involved in this effort.

* Add "Usage and Configuration" section

  This commit was as much restructuring as new content. Instead of being
  in one giant file, usage and configuration documentation can expand
  without bloating a single file.

* Add "Integrations" section

Just a restructuring commit ...

* Add "Guides" section

  This is a promising area of documentation that could easily grow in the
  future, let's prepare for that!

* Add "Contributing" section

  This is also another area that I expect to see significant growth in.
  Contributors to Black could definitely do with some more specific docs
  that clears up certain parts of our slightly confusing project (it's
  only confusing because we're getting big and old!).

* Rewrite CONTRIBUTING.md to just point to RTD
* Rewrite README.md to delegate most info to RTD
* Address feedback + a lot of corrections and edits

  I know I said I wanted to do these after landing this but given there's
  going to be no time between this being merged and a release getting
  pushed, I want these changes to make it in.

  - drop the number flag for mdformat - to reduce diffs, see also:
    https://mdformat.readthedocs.io/en/stable/users/style.html#ordered-lists
  - the GH issue templates should be safe by mdformat, so get rid of the
    exclude
  - clarify our configuration position - i.e. stop claiming we don't have
    many options, instead say we want as little formatting knobs as
    possible
  - lots and lots of punctuation, spelling, and grammar corrections (thanks
    Jelle!)
  - use RTD as the source for the CHANGELOG too
  - visual style cleanups
  - add docs about our .gitignore behaviour
  - expand GHA Action docs
  - clarify we want the PR number in the CHANGELOG entry
  - claify Black's behaviour for with statements post Python 3.9
  - italicize a bunch of "Black"s

  Thank you goes to Jelle, Taneli (hukkinj1 on GH), Felix
  (felix-hilden on GH), and Wouter (wbolster on GH) for the feedback!

* Merge remote-tracking branch 'upstream/master' into reorganize-docs-v2

  merge conflicts suck, although these ones weren't too bad.

* Add changelog entry + fix merge conflict resolution error

  I consider this important enough to be worthy of a changelog entry :)

* Merge branch 'master' into reorganize-docs-v2

  Co-authored-by: Łukasz Langa <lukasz@langa.pl>

* Actually let's continue using prettier

  Prettier works fine for all of the default MyST syntax so let's not
  rock the boat as much. Dropping the mdformat commit was merge-conflict
  filled so here's additional commit instead.

* Address Cooper's, Taneli's, and Jelle's feedback

  Lots of wording improvements by Cooper. Taneli suggested to disable the
  enabled by default MyST syntax not supported by Prettier and I agreed.
  And Jelle found one more spelling error!

* More minor fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: documentation Improvements to the docs (e.g. new topic, correction, etc) T: enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

5 participants