# Generate reference documentation locally

Most reference documentation for fuchsia.dev is generated through an infra
recipe that calls the [`docsgen`](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/docsgen) tool.

The `docsgen` tool calls various other tools that generate reference
documentation, such as:

- [bazel-docgen](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/bazel-docgen)
- [Clidoc](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/clidoc)
- CMLdoc which is generated by [cmc](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/cmc)
- [Driversdoc](https://cs.opensource.google/fuchsia/fuchsia/+/main:/build/drivers/create_all_drivers_doc.gni)
- [FIDLdoc](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/fidl/fidldoc/)
- [fx helpdoc](https://cs.opensource.google/fuchsia/fuchsia/+/main:/tools/devshell/helpdoc)
- [Build action for Zircon syscalls](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/vdso/BUILD.gn;l=166-188)

Once the infra recipe generates this documentation, it is pushed to the
[`reference-docs` repository](https://fuchsia.googlesource.com/reference-docs/+/main/main/).

Then, the documentation is published to the reference section of fuchsia.dev,
which is [fuchsia.dev/reference/](https://fuchsia.dev/reference/).

There is also manually created reference documentation that is usually published
to a URL that is prefixed with `fuchsia.dev/fuchsia-src/reference/`. The source
for this documentation is in [`//docs/reference/`](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/reference/).

## Generate reference documentation locally

In some cases, it can be useful to run `docsgen` locally to review the output of
the various tools that generate documentation.

To run `docsgen` locally:

1. Add `docsgen` to `fx set`. For example, you can use the `minimal`
   configuration:

       fx set minimal.x64 --with //tools/docsgen

2. Build and run `docsgen`:

   > [!NOTE]
   > **Note:** Running `docsgen` also implicitly runs `doc-checker`. For more information about `doc-checker`, see [Automated documentation checks](https://fuchsia.dev/docs/contribute/docs/doc-checker)

       fx build tools/docsgen

   > [!NOTE]
   > **Note:** Some of the reference documentation is packaged in a `.zip` file, so make sure to extract the documentation.

   You can then review the built reference documentation in
   `//out/default/obj/docsgen` of your Fuchsia checkout.

[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/contribute/docs/docsgen.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/contribute/docs/docsgen.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/contribute/docs/docsgen.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/contribute/docs/docsgen.md "Edit the source code of this page")