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

I didn’t see it in www.ziglang.org/content/en-US/learn at main · ziglang/www.ziglang.org · GitHub

In fact, the index.smd file in there appears to be missing the links to the language reference.

Is there a separate repo for the Zig language reference doc?

(Welcome to Ziggit @uvtc)

It looks like the source for Documentation - The Zig Programming Language is
zig/doc/langref.html.in at master · ziglang/zig · GitHub

3 Likes

Thanks, @tobyjaffey , though, that file is html. My understanding is that the Zig docs are in markdown. Is there a markdown source file from whence that langref.html.in came?

langref.html.in references zig files in https://github.com/ziglang/zig/tree/master/doc/langref

For example {#code|hello.zig#} references the file hello.zig in doc/langref.

1 Like

Thanks, @dimdin . Sorry if I was not clear: I meant, where is the doc source file (the markdown file) that gets processed into langref.html.in (doc source vs zig source code file). I realize that thare are zig source files that are separate from the doc, and which get pulled in during some processing phase to create the final html doc on the website.

I thought it would be strange if the language reference (langref.html.in) were handwritten html (rather than being generated from a markdown file), but perhaps that’s the case?

langref.html.in is the (handwritten) source. I’ll take that as a compliment :wink:

4 Likes

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

Got it. Thanks, all!