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.

fileSourceLineNumbersHtml

html_render.fileSourceLineNumbersHtml
pub fn fileSourceLineNumbersHtml(
    file_index: Walk.File.Index,
    out: *std.ArrayListUnmanaged(u8),
    root_node: Ast.Node.Index,
) !void

File

lib/docs/wasm/html_render.zig:33

Code

pub fn fileSourceLineNumbersHtml(
    file_index: Walk.File.Index,
    out: *std.ArrayListUnmanaged(u8),
    root_node: Ast.Node.Index,
) !void {
    const ast = file_index.get_ast();
    const first_token_line = ast.tokenLocation(0, ast.firstToken(root_node)).line;
    const last_token_line = ast.tokenLocation(0, ast.lastToken(root_node)).line;
    for (first_token_line..last_token_line + 1) |i| {
        try out.print(gpa, "<span>{d}</span>\n", .{i + 1});
    }
}