renderMap renders a map as markdown-style headers
(val reflect.Value, title string, output *strings.Builder, depth int)
| 215 | |
| 216 | // renderMap renders a map as markdown-style headers |
| 217 | func renderMap(val reflect.Value, title string, output *strings.Builder, depth int) { |
| 218 | if val.Len() == 0 { |
| 219 | return |
| 220 | } |
| 221 | |
| 222 | // Print title without FormatInfoMessage styling |
| 223 | if title != "" { |
| 224 | if depth == 0 { |
| 225 | fmt.Fprintf(output, "# %s\n\n", title) |
| 226 | } else { |
| 227 | fmt.Fprintf(output, "%s %s\n\n", strings.Repeat("#", depth+1), title) |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | // Render map entries |
| 232 | for _, key := range val.MapKeys() { |
| 233 | mapValue := val.MapIndex(key) |
| 234 | fmt.Fprintf(output, " %-18s %v\n", fmt.Sprintf("%v:", key), formatFieldValue(mapValue)) |
| 235 | } |
| 236 | output.WriteString("\n") |
| 237 | } |
| 238 | |
| 239 | // buildTableConfig builds a TableConfig from a slice of structs |
| 240 | func buildTableConfig(val reflect.Value, title string) TableConfig { |
no test coverage detected