Bazel docs structure
The source of truth for Bazel documentation isbazelbuild/bazel, where docs
live alongside the code. bazel-contrib/bazel-docs is the hosting and pipeline
layer: it syncs content from bazelbuild/bazel, generates PR previews, and
holds Mintlify configuration. Content changes always go to bazelbuild/bazel.
Bazel docs use MDX format, Markdown with a YAML
frontmatter block at the top. Every page must start with:
Prerequisites
Before you start, you need:- A GitHub account
- A fork of
bazelbuild/bazel - Git
- The Mintlify CLI for local preview.
Make a minor change
For small isolated changes, such as a typo, broken link, phrasing tweaks, you can edit directly in the GitHub web UI without cloning anything.- Find the file in
bazelbuild/bazel/docs/on GitHub. - To edit the file, click the pencil icon in the top-right corner.
- Make your edit.
- Click Commit changes…, provide a commit message, and click Propose changes”.
- GitHub prompts you to open a pull request. Set the base branch to
masterand click Create pull request it.
Update existing content
Use this workflow for anything larger than a typo, such as rewording a section, correcting outdated information, or adding a paragraph to an existing page.Set up locally
Forkbazelbuild/bazel on GitHub first, then clone the repo and add the upstream remote:
Make and preview your changes
Check out a new branch off ofmaster.
docs/, for example, docs/concepts/labels.mdx.
To preview locally, you need a local copy of bazel-contrib/bazel-docs:
bazel-docs mirror to preview them:
Commit and open a PR
Add, commit, and push your changes:bazelbuild/bazel master.
Add a new section to an existing page
Follow the same workflow as Update existing content. A few things to keep in mind: Add a heading anchor ID. Every heading should have an explicit{#id} so
URLs to that section stay stable even if the heading text changes:
##) for top-level
sections and H3 (###) for subsections. Don’t skip levels.
Update the page if there’s a table of contents or “On this page” intro.
Some pages have an introductory list of topics. Add your section there too.
Add a new page
-
Create the MDX file in the appropriate
docs/subdirectory. Every file must start with frontmatter: -
Add your page to the sidebar navigation. This requires a separate change
in
bazel-contrib/bazel-docs. See Update the docs navigation for instructions. For an initial PR, you can skip this and ask a maintainer to help. - Follow the same branch, commit, and PR steps as Update existing content.
MDX basics for doc contributors
MDX is mostly standard Markdown with a few differences.Self-closing HTML tags
JSX requires void elements to be self-closing. Use<img ... /> and
<br />, not <img ...> or <br>.
Links
Use root-relative paths for internal links. Don’t include the.mdx extension in the links:
Code blocks
Always specify a language for syntax highlighting:bash, python, starlark, json,
posix-terminal.
Images
Place images in theimages/ subdirectory alongside your MDX file and
reference them with a root-relative path:
/>,
but <img> tags must self-close when you use them directly:
Notes and callouts
Mintlify supports callout components. Use them for important warnings or tips:What to expect after submitting
- The Google CLA bot checks that you’ve signed the Contributor License Agreement. You only need to do this once.
- CI runs a docs validation check.
- A maintainer reviews your PR and might request edits. Response times vary.
- Once approved, a maintainer merges your changes to
master. They appear on the live site after the next sync.
Get help
- Join the Bazel community Slack and ask in the
#documentationchannel. This is the best place for quick questions about the docs platform or contribution process. - File an issue in
bazelbuild/bazelwith the labeltype: documentation. - For questions about the docs platform, open an
issue in
bazel-contrib/bazel-docs.