RenderStruct renders a Go struct to console output using reflection and struct tags. It supports: - Rendering structs as markdown-style headers with key-value pairs - Rendering slices as tables using the console table renderer - Rendering maps as markdown headers Struct tags: - `console:"title:My T
(v any)
| 27 | // - `console:"omitempty"` - Skips zero values |
| 28 | // - `console:"-"` - Skips the field entirely |
| 29 | func RenderStruct(v any) string { |
| 30 | renderLog.Printf("Rendering struct: type=%T", v) |
| 31 | var output strings.Builder |
| 32 | renderValue(reflect.ValueOf(v), "", &output, 0) |
| 33 | renderLog.Printf("Struct rendering complete: output_size=%d bytes", output.Len()) |
| 34 | return output.String() |
| 35 | } |
| 36 | |
| 37 | // renderValue recursively renders a reflect.Value to the output builder |
| 38 | func renderValue(val reflect.Value, title string, output *strings.Builder, depth int) { |