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.
fnprocessExecutableOpen(
userdata: ?*anyopaque,
flags: Dir.OpenFileOptions,
) process.OpenExecutableError!File {
constev: *Evented = @ptrCast(@alignCast(userdata));
// _NSGetExecutablePath() returns a path that might be a symlink to
// the executable. Here it does not matter since we open it.
varsymlink_path_buf: [c.PATH_MAX + 1]u8 = undefined;
varn: u32 = symlink_path_buf.len;
constrc = c._NSGetExecutablePath(&symlink_path_buf, &n);
if (rc != 0) returnerror.NameTooLong;
constsymlink_path = std.mem.sliceTo(&symlink_path_buf, 0);
returndirOpenFile(ev, .cwd(), symlink_path, flags);
}