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.
fncollect_docs(
list: *ArrayList(u8),
ast: *constAst,
first_doc_comment: Ast.TokenIndex,
) Oom!void {
list.clearRetainingCapacity();
varit = first_doc_comment;
while (true) : (it += 1) switch (ast.tokenTag(it)) {
.doc_comment, .container_doc_comment => {
// It is tempting to trim this string but think carefully about how
// that will affect the markdown parser.
constline = ast.tokenSlice(it)[3..];
trylist.appendSlice(gpa, line);
},
else => break,
};
}