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.
fnisOneLineContainerDecl(
tree: Ast,
container_decl: Ast.full.ContainerDecl,
lbrace: Ast.TokenIndex,
rbrace: Ast.TokenIndex,
) bool {
// We print all the members in one-line unless one of the following conditions are true:
// 1. The container has comments or multiline strings.
if (hasComment(tree, lbrace, rbrace) orhasMultilineString(tree, lbrace, rbrace)) {
returnfalse;
}
// 2. The container has a container comment.if (tree.tokenTag(lbrace + 1) == .container_doc_comment) returnfalse;
// 3. A member of the container has a doc comment.if (hasDocComment(tree, lbrace + 1, rbrace))
returnfalse;
// 4. The container has non-field members.for (container_decl.ast.members) |member| {
if (tree.fullContainerField(member) == null) returnfalse;
}
returntrue;
}