Where is the doc source for the Zig language reference doc?

The langref is just a single HTML file. You can obtain the file by saving the result of going to Documentation - The Zig Programming Language.

The langref HTML is produced by running

zig build langref

in the zig repo GitHub - ziglang/zig: General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software..

This takes in zig-repo/doc/langref.html.in (hand written) and produces zig-repo/zig-out/doc/langref.html. The html.in also references files in zig-repo/doc/langref/*. These files are built and tested during the build of the langref. The zig files show up as the code examples in the langref.

The github CI for the langref addionally runs superhtml to check for valid HTML. You can run this locally by installing superhtml: GitHub - kristoff-it/superhtml: HTML Language Server & Templating Language Library.

Once superhtml is on your PATH, you can check the langref HTML using:

zig build langref -Denable-superhtml=true
3 Likes