This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.
pubfnpackagePath(
maker: *constMaker,
arena: Allocator,
package_index: Configuration.Package.Index,
sub_path: []constu8,
) Allocator.Error!Path {
constc = &maker.scanned_config.configuration;
constgraph = maker.graph;
constpackage = package_index.get(c) orelsereturn .{
.root_dir = graph.build_root_directory,
.sub_path = sub_path,
};
// Currently, neither configurer nor Maker is aware of the standard zig
// package path, and the root path is stored as a bare string rather than
// relative to a known base directory. Without changing that, we must
// construct a cwd relative path here.
return .{
.root_dir = .cwd(),
.sub_path = tryDir.path.join(arena, &.{ package.root_path.slice(c), sub_path }),
};
}