const std = @import("std"); const Children = @import("parser.zig").Children; pub fn printChildren(writer: anytype, children: Children) @TypeOf(writer).Error!void { for (children.items) |child| { switch (child) { .document => unreachable, .heading => |heading| { try writer.print("{1s}", .{ heading.level, heading.text }); }, .paragraph => |paragraph| { try writer.print("

{s}

", .{paragraph.text}); }, .block_quote => |block_quote| { try writer.print("
", .{}); try printChildren(writer, block_quote.children); try writer.print("
", .{}); }, .list => |list| { try writer.print("", .{}); }, .list_item => |list_item| { try writer.print("
  • ", .{}); try printChildren(writer, list_item.children); try writer.print("
  • ", .{}); }, } } }