Project: /_project.yaml Book: /_book.yaml
{% include “_buttons.html” %}
Thank you for contributing to Bazel's documentation. This serves as a quick documentation style guide to get you started. For any style questions not answered by this guide, follow the Google developer documentation style guide{: .external}.
Bazel docs should uphold these principles:
This section contains basic writing tips.
Page-level headings start at H2. (H1 headings are used as page titles.)
Make headers as short as is sensible. This way, they fit in the TOC without wrapping.
Use sentence case for headings
Try to make headings task-based or actionable. If headings are conceptual, it may be based around understanding, but write to what the user does.
Capitalize proper nouns, such as Bazel and Starlark.
Keep it consistent. Don't introduce new names for existing concepts. Where applicable, use the term defined in the Glossary.
Each page should have one purpose and that should be defined at the beginning. This helps readers find what they need quicker.
At the end of the page, tell the reader what to do next. For pages where there is no clear action, you can include links to similar concepts, examples, or other avenues for exploration.
In Bazel documentation, the audience should primarily be users—the people using Bazel to build their software.
Address your reader as “you”. (If for some reason you can't use “you”, use gender-neutral language, such as they.)
If your audience is NOT general Bazel users, define the audience at the beginning of the page or in the section. Other audiences can include maintainers, contributors, migrators, or other roles.
Avoid “we”. In user docs, there is no author; just tell people what's possible.
Where possible, avoid terms that orient things in time, such as referencing specific dates (Q2 2022) or saying “now”, “currently”, or “soon.” These go stale quickly and could be incorrect if it's a future projection. Instead, specify a version level instead, such as "Bazel X.x and higher supports <feature> or a GitHub issue link.
Use present tense. Avoid past or future tense unless absolutely necessary for clarity.
Where possible, use active voice (where a subject acts upon an object) not passive voice (where an object is acted upon by a subject). Generally, active voice makes sentences clearer because it shows who is responsible. If using active voice detracts from clarity, use passive voice.
Write with a business friendly tone.
Avoid colloquial language. It's harder to translate phrases that are specific to English.
Avoid overly formal language. Write as though you‘re explaining the concept to someone who is curious about tech, but doesn’t know the details.
For readability, wrap lines at 80 characters. Long links or code snippets may be longer, but should start on a new line. For example:
Note: Where possible, use Markdown instead of HTML in your files. Follow the GitHub Markdown Syntax Guide{: .external} for recommended Markdown style.
Use descriptive link text instead of “here” or “below”. This practice makes it easier to scan a doc and is better for screen readers.
End the sentence with the link, if possible.
Use angle brackets to denote a variable that users should change. In Markdown, escape the angle brackets with a back slash: \<example\>
.
bazel help <command>
: Prints help and options for <command>
Especially for complicated code samples, use placeholders that make sense in context.
Use the auto-generated TOC supported by the site. Don't add a manual TOC.
Code samples are developers' best friends. You probably know how to write these already, but here are a few tips.
If you're referencing a small snippet of code, you can embed it in a sentence. If you want the reader to use the code, such as copying a command, use a code block.
```shell ...
bazel help <command>
: Prints help and options for <command>