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.
Zig › docs/ › wasm/ › main.zig › decl_type_html
decl_type_html
main.decl_type_html
export fn decl_type_html (decl_index : Decl .Index ) String
File
Code
export fn decl_type_html (decl_index : Decl .Index ) String {
const decl = decl_index .get ();
const ast = decl .file .get_ast ();
string_result .clearRetainingCapacity ();
t : {
if (ast .fullVarDecl (decl .ast_node )) |var_decl | {
if (var_decl .ast .type_node .unwrap ()) |type_node | {
string_result .appendSlice (gpa , "<code>" ) catch @panic ("OOM" );
fileSourceHtml (decl .file , &string_result , type_node , .{
.skip_comments = true ,
.collapse_whitespace = true ,
}) catch |e | {
std .debug .panic ("unable to render html: {s}" , .{@errorName (e )});
};
string_result .appendSlice (gpa , "</code>" ) catch @panic ("OOM" );
break :t ;
}
}
}
return String .init (string_result .items );
}