ziglang/zig
std-docs
Active contributors: andrewrk, mlugg
Purpose
lib/compiler/std-docs.zig (~16 KB) backs zig std. Running zig std boots a tiny local HTTP server and opens it in the user's browser. The page hosted there is the Zig standard library's autodoc — a search-as-you-type interface over every type, declaration, and pub fn exported from lib/std/.
How it works
sequenceDiagram
actor User
User->>+zig: zig std
zig->>+std-docs: lib/compiler/std-docs.zig main()
std-docs->>+std.http.Server: bind on localhost
std-docs->>+lib/docs/index.html: serve UI
User->>+std.http.Server: open http://localhost:<port>
std.http.Server-->>-User: HTML + JSON index- The UI bundle lives in
lib/docs/(HTML/JS/CSS). - The JSON index is generated at compile time by the same autodoc machinery used for
zig build std-docs(build.zig'sinstall_std_docsstep). - Search and navigation happen entirely client-side.
Build-time docs
zig build std-docs builds the same documentation as a static site under zig-out/doc/std/. lib/docs/index.html is the entry point (and the -Denable-superhtml flag in build.zig validates it).
Integration points
- Build system:
build.zig'saddInstallDirectory(...)forgetEmittedDocs(). - Autodoc generation: lives inside the compiler itself — the same path that emits doc JSON for any package compiled with
--emit-docs. std.http.Server: the embedded server.
Key source files
| File | Purpose |
|---|---|
lib/compiler/std-docs.zig |
The CLI tool. |
lib/docs/ |
HTML/JS frontend. |
lib/std/http.zig |
HTTP server used to serve the page. |
See build.zig for the matching std-docs build step.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.