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.
fnisOneLineFnProto(
tree: Ast,
fn_proto: Ast.full.FnProto,
lparen: Ast.TokenIndex,
rparen: Ast.TokenIndex,
) bool {
consttrailing_comma = tree.tokenTag(rparen - 1) == .comma;
if (trailing_commaorhasComment(tree, lparen, rparen))
returnfalse;
// Check that there are no doc commentsvarafter_last_param = lparen + 1;
for (fn_proto.ast.params) |expr| {
// Looking before each param is insufficient since anytype is not included in `params`if (hasDocComment(tree, after_last_param, tree.firstToken(expr)))
returnfalse;
after_last_param = tree.lastToken(expr) + 1;
}
return !hasDocComment(tree, after_last_param, rparen);
}