Zig can generate documentation from doc comments.
For the library package, I think it would be useful to have a step in zig build to generate documentation. But there is no such step for build.zig which zig init generates.
So I think it would be useful to have a step like the following in build.zig which zig init generates:
|
const autodoc_test = b.addObject(.{ |
|
.name = "std", |
|
.zig_lib_dir = b.path("lib"), |
|
.root_module = b.createModule(.{ |
|
.root_source_file = b.path("lib/std/std.zig"), |
|
.target = target, |
|
.optimize = .Debug, |
|
}), |
|
}); |
|
const install_std_docs = b.addInstallDirectory(.{ |
|
.source_dir = autodoc_test.getEmittedDocs(), |
|
.install_dir = .prefix, |
|
.install_subdir = "doc/std", |
|
}); |
|
//if (enable_tidy) install_std_docs.step.dependOn(check_autodocs); |
|
if (std_docs) { |
|
b.getInstallStep().dependOn(&install_std_docs.step); |
|
} |
For those unfamiliar with the Zig build system, I think it is easier to edit a template rather than writing such a step from scratch.
Zig can generate documentation from doc comments.
For the library package, I think it would be useful to have a step in
zig buildto generate documentation. But there is no such step forbuild.zigwhichzig initgenerates.So I think it would be useful to have a step like the following in
build.zigwhichzig initgenerates:zig/build.zig
Lines 51 to 68 in bf6ee7c
For those unfamiliar with the Zig build system, I think it is easier to edit a template rather than writing such a step from scratch.