Zig 0.17.0-dev (Split by item)

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.

decl_field_html_fallible

main.decl_field_html_fallible
fn decl_field_html_fallible(
    out: *ArrayList(u8),
    decl_index: Decl.Index,
    field_node: Ast.Node.Index,
) !void

File

lib/docs/wasm/main.zig:465

Code

fn decl_field_html_fallible(
    out: *ArrayList(u8),
    decl_index: Decl.Index,
    field_node: Ast.Node.Index,
) !void {
    const decl = decl_index.get();
    const ast = decl.file.get_ast();
    try out.appendSlice(gpa, "<pre><code>");
    try fileSourceHtml(decl.file, out, field_node, .{});
    try out.appendSlice(gpa, "</code></pre>");

    const field = ast.fullContainerField(field_node).?;

    if (Decl.findFirstDocComment(ast, field.firstToken()).unwrap()) |first_doc_comment| {
        try out.appendSlice(gpa, "<div class=\"fieldDocs\">");
        try render_docs(out, decl_index, first_doc_comment, false);
        try out.appendSlice(gpa, "</div>");
    }
}