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 standard library. Private Function
fnoutputUnicodeEscape(codepoint: u21, w: *Writer) Error!void {
if (codepoint <= 0xFFFF) {
// If the character is in the Basic Multilingual Plane (U+0000 through U+FFFF),// then it may be represented as a six-character sequence: a reverse solidus, followed// by the lowercase letter u, followed by four hexadecimal digits that encode the character's code point.tryw.writeAll("\\u");
tryw.printInt(codepoint, 16, .lower, .{ .width = 4, .fill = '0' });
} else {
assert(codepoint <= 0x10FFFF);
// To escape an extended character that is not in the Basic Multilingual Plane,// the character is represented as a 12-character sequence, encoding the UTF-16 surrogate pair.consthigh = @as(u16, @intCast((codepoint - 0x10000) >> 10)) + 0xD800;
constlow = @as(u16, @intCast(codepoint & 0x3FF)) + 0xDC00;
tryw.writeAll("\\u");
tryw.printInt(high, 16, .lower, .{ .width = 4, .fill = '0' });
tryw.writeAll("\\u");
tryw.printInt(low, 16, .lower, .{ .width = 4, .fill = '0' });
}
}