|
7 | 7 | "path/filepath" |
8 | 8 | "sort" |
9 | 9 | "strings" |
| 10 | + |
| 11 | + "github.com/GrayCodeAI/iterate/internal/ui/highlight" |
10 | 12 | ) |
11 | 13 |
|
12 | 14 | // RegisterModeCommands adds agent mode and display commands. |
@@ -78,6 +80,7 @@ func registerDisplayNavCommands(r *Registry) { |
78 | 80 | "/theme", "set color theme", cmdTheme, |
79 | 81 | "/shortcuts", "list all keyboard shortcuts", cmdShortcuts, |
80 | 82 | "/providers", "list configured providers and status", cmdProviders, |
| 83 | + "/render", "toggle markdown vs raw response rendering", cmdRender, |
81 | 84 | ) |
82 | 85 | } |
83 | 86 |
|
@@ -459,3 +462,27 @@ func cmdProviders(ctx Context) Result { |
459 | 462 | fmt.Printf(" Use %s/provider <name>%s to switch providers.\n\n", ColorBold, ColorReset) |
460 | 463 | return Result{Handled: true} |
461 | 464 | } |
| 465 | + |
| 466 | +func cmdRender(ctx Context) Result { |
| 467 | + // Toggle or explicitly set: /format [markdown|raw|on|off] |
| 468 | + if ctx.HasArg(1) { |
| 469 | + arg := strings.ToLower(ctx.Arg(1)) |
| 470 | + switch arg { |
| 471 | + case "markdown", "md", "on", "true": |
| 472 | + highlight.MarkdownEnabled = true |
| 473 | + case "raw", "plain", "off", "false": |
| 474 | + highlight.MarkdownEnabled = false |
| 475 | + default: |
| 476 | + fmt.Printf("Usage: /format [markdown|raw]\n") |
| 477 | + return Result{Handled: true} |
| 478 | + } |
| 479 | + } else { |
| 480 | + highlight.MarkdownEnabled = !highlight.MarkdownEnabled |
| 481 | + } |
| 482 | + if highlight.MarkdownEnabled { |
| 483 | + PrintSuccess("format: markdown (syntax highlighting on)") |
| 484 | + } else { |
| 485 | + PrintSuccess("format: raw (plain text output)") |
| 486 | + } |
| 487 | + return Result{Handled: true} |
| 488 | +} |
0 commit comments