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.
fnstartHeading(unindented_line: []constu8) ?HeadingStart {
varlevel: u3 = 0;
returnfor (unindented_line, 0..) |c, i| {
switch (c) {
'#' => {
if (level == 6) breaknull;
level += 1;
},
' ' => {
// We must have seen at least one # by this point, since
// unindented_line has no leading spaces.
assert(level > 0);
break .{
.level = level,
.rest = unindented_line[i + 1 ..],
};
},
else => breaknull,
}
} elsenull;
}