Skip to content
baskingspotPublic

About

Zig standard library documentation in the terminal.

Topics

Resources

Stars

150 stars

Watchers

2 watching

Forks

Repository files navigation

zigdoc

Zig standard library documentation in the terminal.

The doc comments in the Zig standard library are the manual, and they are spread over hundreds of files. zigdoc std.mem.Allocator prints the comment, the file and line, the signature, and the members, without leaving the terminal. Run it in a project and it reads the modules that build.zig declares, so a dependency is documented the same way.

What is in it

  • Symbols: one symbol at a time, with its doc comment, signature, and members. zigdoc std.mem.Allocator prints all four.
  • Modules from your build: zigdoc vaxis.Window reads the modules that your build.zig declares, and --dump-imports prints them as JSON.
  • Starting a project: zigdoc @init writes a Zig 0.16 project with an AGENTS.md that tells a coding agent how to work in it.

Not implemented:

  • A pinned standard library: zigdoc reads the zig on PATH, and ZIG_LIB_DIR points it at another lib directory.
  • Modules that build.zig does not declare, even when a source file imports one.
  • A quiet run: the import trace goes to stderr on every run.

Install

zigdoc runs zig to find the standard library, so zig must be on PATH. It reads projects on Zig 0.14, 0.15, and 0.16.

With Homebrew, on macOS or Linux:

brew install --cask baskingspot/tap/zigdoc

With mise:

mise use -g github:baskingspot/zigdoc

With Nix:

nix run github:baskingspot/zigdoc/v0.6.0 -- std.ArrayList

Each release has a tarball for linux-x64, linux-arm64, and macos-arm64, a zip for windows-x64, and a SHA256SUMS file. The archives are attested, so check a download with gh attestation verify FILE -R baskingspot/zigdoc --signer-repo baskingspot/gh-actions.

From source:

zig build install -Doptimize=ReleaseFast --prefix $HOME/.local

Documentation

Work on it

nix develop
just ci

nix develop provides the toolchain and the site tools. just lists the recipes, just ci runs what CI runs, just guide serves the guide with live reload, and just doc builds the whole site into zig-out/site/zigdoc/. The command reference page is generated by zig build reference.

License

MIT. See LICENSE. The logo files in docs/static/ are baskingspot marks and are not covered by it. See docs/static/LICENSE.

How it's made

Built with LLM assistance.

baskingspot

About

Zig standard library documentation in the terminal.

Topics

Resources

Stars

150 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages