Files
the-littlest-jupyterhub/docs/contributing/docs.md

214 lines
8.1 KiB
Markdown
Raw Normal View History

(contributing-docs)=
# Writing documentation
2018-07-10 10:21:53 -07:00
:::{note}
Heavily inspired by the
[django project's guidelines](https://docs.djangoproject.com/en/dev/internals/contributing/writing-documentation/)
:::
2018-07-10 10:21:53 -07:00
We place a high importance on consistency, readability and completeness of documentation.
If a feature is not documented, it does not exist. If a behavior is not documented,
it is a bug! We try to treat our
documentation like we treat our code: we aim to improve it as often as
possible.
Documentation changes generally come in two forms:
- General improvements: typo corrections, error fixes and better
2018-07-10 10:21:53 -07:00
explanations through clearer writing and more examples.
- New features: documentation of features that have been added to the
2018-07-10 10:21:53 -07:00
framework since the last release.
This section explains how writers can craft their documentation changes
in the most useful and least error-prone ways.
## Getting the raw documentation
2018-07-10 10:21:53 -07:00
Though TLJH's documentation is intended to be read as HTML at
<https://the-littlest-jupyterhub.readthedocs.io/>, we edit it as a collection of text files for
maximum flexibility. These files live in the top-level `docs/` directory of
2018-07-10 10:21:53 -07:00
TLJH's repository.
If you'd like to start contributing to our docs, get the development version of
TLJH from the source code repository. The development version has the
latest-and-greatest documentation, just as it has latest-and-greatest code.
## Getting started with Sphinx
2018-07-10 10:21:53 -07:00
TLJH's documentation uses the [Sphinx](http://sphinx-doc.org/) documentation system, which in turn
is based on [docutils](http://docutils.sourceforge.net/). The basic idea is that lightly-formatted plain-text
2018-07-10 10:21:53 -07:00
documentation is transformed into HTML, PDF, and any other output format.
To build the documentation locally, install the Sphinx dependencies:
2018-07-10 10:21:53 -07:00
```console
$ cd docs/
$ pip install -r requirements.txt
```
2018-07-10 10:21:53 -07:00
Then from the `docs` directory, build the HTML:
2018-07-10 10:21:53 -07:00
```console
$ make html
```
2018-07-10 10:21:53 -07:00
2019-04-14 21:25:38 +01:00
If you encounter this error, it's likely that you are running inside a virtual environment.
```console
Error in "currentmodule" directive:
```
To get started contributing, you'll want to get familiar with [markdown](https://commonmark.org/help/) and [MyST](https://myst-parser.readthedocs.io).
2018-07-10 10:21:53 -07:00
Your locally-built documentation will be themed differently than the
documentation at [the-littlest-jupyterhub.readthedocs.io](https://the-littlest-jupyterhub.readthedocs.io).
2018-07-10 10:21:53 -07:00
This is OK! If your changes look good on your local machine, they'll look good
on the website.
## How the documentation is organized
2018-07-10 10:21:53 -07:00
The documentation is organized into several categories:
- **Tutorials** take the reader by the hand through a series
2018-07-10 10:21:53 -07:00
of steps to create something.
The important thing in a tutorial is to help the reader achieve something
useful, preferably as early as possible, in order to give them confidence.
Explain the nature of the problem we're solving, so that the reader
understands what we're trying to achieve. Don't feel that you need to begin
with explanations of how things work - what matters is what the reader does,
not what you explain. It can be helpful to refer back to what you've done and
explain afterwards.
2018-08-03 14:42:44 -07:00
**Installation Tutorials** are a special subcategory of tutorials that
teach the user how to install TLJH in various cloud providers / bare metal
systems. These should cross-link a lot to other parts of the documentation,
avoid forcing the user to learn to SSH if possible & have lots of screenshots.
- **Topic guides** aim to explain a concept or subject at a
2018-07-10 10:21:53 -07:00
fairly high level.
Link to reference material rather than repeat it. Use examples and don't be
reluctant to explain things that seem very basic to you - it might be the
explanation someone else needs.
Providing background context helps a newcomer connect the topic to things
that they already know.
- **Reference guides** contain technical reference for APIs.
2018-07-10 10:21:53 -07:00
They describe the functioning of TLJH's internal machinery and instruct in
its use.
Keep reference material tightly focused on the subject. Assume that the
reader already understands the basic concepts involved but needs to know or
be reminded of how TLJH does it.
Reference guides aren't the place for general explanation. If you find
yourself explaining basic concepts, you may want to move that material to a
topic guide.
- **How-to guides** are recipes that take the reader through
2018-07-10 10:21:53 -07:00
steps in key subjects.
What matters most in a how-to guide is what a user wants to achieve.
A how-to should always be result-oriented rather than focused on internal
details of how TLJH implements whatever is being discussed.
These guides are more advanced than tutorials and assume some knowledge about
how TLJH works. Assume that the reader has followed the tutorials and don't
hesitate to refer the reader back to the appropriate tutorial rather than
repeat the same material.
- **Troubleshooting guides** help reader answer the question "Why is my JupyterHub
2018-07-10 10:21:53 -07:00
not working?".
These guides help readers try find causes for their symptoms, and hopefully fix
the issues. Some of these need to be specific to cloud providers, and that is
acceptable.
## Writing style
2018-07-10 10:21:53 -07:00
Typically, documentation is written in second person, referring to the reader as “you”.
2018-10-11 16:54:05 -04:00
When using pronouns in reference to a hypothetical person, such as "a user with
2018-07-10 10:21:53 -07:00
a running notebook", gender neutral pronouns (they/their/them) should be used.
Instead of:
- he or she... use they.
- him or her... use them.
- his or her... use their.
- his or hers... use theirs.
- himself or herself... use themselves.
2018-07-10 10:21:53 -07:00
## Commonly used terms
2018-07-10 10:21:53 -07:00
Here are some style guidelines on commonly used terms throughout the
documentation:
- **TLJH** -- common abbreviation of The Littlest JupyterHub. Fully
2018-07-10 10:21:53 -07:00
capitalized except when used in code / the commandline.
- **Python** -- when referring to the language, capitalize Python.
- **Notebook Interface** -- generic term for referring to JupyterLab,
classic notebook & other user interfaces for accessing.
2018-07-10 10:21:53 -07:00
## Guidelines for markdown files
2018-07-10 10:21:53 -07:00
These guidelines regulate the format of our markdown
2018-07-10 10:21:53 -07:00
documentation:
- In section titles, capitalize only initial words and proper nouns.
2018-07-10 10:21:53 -07:00
- Wrap the documentation at sentence breaks or around 120 characters wide, unless a code example
2018-07-10 10:21:53 -07:00
is significantly less readable when split over two lines, or for another
good reason.
## Documenting new features
2018-07-10 10:21:53 -07:00
Our policy for new features is:
> All new features must have appropriate documentation before they
> can be merged.
2018-07-10 10:21:53 -07:00
## Choosing image size
2019-01-31 11:24:00 -08:00
When adding images to the documentation, try to keep them as small as possible.
Larger images make the site load more slowly on browsers, and may make the site
inaccessible for people with a slow internet connection.
If you're adding screenshots, make the size of your shot as small as possible.
If you're uploading large images, consider using an image optimizer in order
to reduce its size.
2018-07-10 10:21:53 -07:00
For example, for PNG files, use OptiPNG and AdvanceCOMP's `advpng`:
2018-07-10 10:21:53 -07:00
```console
$ cd docs
$ optipng -o7 -zm1-9 -i0 -strip all `find . -type f -not -path "./_build/*" -name "*.png"`
$ advpng -z4 `find . -type f -not -path "./_build/*" -name "*.png"`
```
2018-07-10 10:21:53 -07:00
This is based on OptiPNG version 0.7.5. Older versions may complain about the
`--strip all` option being lossy.
2018-07-10 10:21:53 -07:00
## Spelling check
2018-07-10 10:21:53 -07:00
Before you commit your docs, it's a good idea to run the spelling checker.
You'll need to install a couple packages first:
- [pyenchant](https://pypi.org/project/pyenchant/) (which requires
[enchant](https://www.abisource.com/projects/enchant/))
- [sphinxcontrib-spelling](https://pypi.org/project/sphinxcontrib-spelling/)
2018-07-10 10:21:53 -07:00
Then from the `docs` directory, run `make spelling`. Wrong words (if any)
2018-07-10 10:21:53 -07:00
along with the file and line number where they occur will be saved to
`_build/spelling/output.txt`.
2018-07-10 10:21:53 -07:00
If you encounter false-positives (error output that actually is correct), do
one of the following:
- Surround inline code or brand/technology names with grave accents (\`).
- Find synonyms that the spell checker recognizes.
- If, and only if, you are sure the word you are using is correct - add it
to `docs/spelling_wordlist` (please keep the list in alphabetical order).