From efc673de54a1d4bad1ff97ca614adac171e86308 Mon Sep 17 00:00:00 2001 From: Luke Russell Date: Thu, 14 May 2026 16:03:43 -0700 Subject: [PATCH 1/2] go --- cmd/api/api.go | 2 +- docs/reference/commands/slack_api.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/api/api.go b/cmd/api/api.go index d757edd6..39e60f2c 100644 --- a/cmd/api/api.go +++ b/cmd/api/api.go @@ -57,7 +57,7 @@ func NewCommand(clients *shared.ClientFactory) *cobra.Command { "", "Body format is auto-detected from positional arguments:", " - Multiple key=value args: form-encoded (token in request body)", - " - Single arg starting with { or [: JSON (Bearer token in header)", + " - Single arg starting with \\{ or \\[: JSON (Bearer token in header)", " - No args: token sent in Authorization header", "", "Use --json to explicitly send a JSON body, or --data for a form-encoded body string.", diff --git a/docs/reference/commands/slack_api.md b/docs/reference/commands/slack_api.md index bc134042..30e4e8bf 100644 --- a/docs/reference/commands/slack_api.md +++ b/docs/reference/commands/slack_api.md @@ -11,7 +11,7 @@ Parameters are passed as key=value pairs, a JSON body, or via flags. Body format is auto-detected from positional arguments: - Multiple key=value args: form-encoded (token in request body) - - Single arg starting with { or [: JSON (Bearer token in header) + - Single arg starting with \{ or \[: JSON (Bearer token in header) - No args: token sent in Authorization header Use --json to explicitly send a JSON body, or --data for a form-encoded body string. From 39caf58d067d677754e8dc4d32935f3fd5f85b22 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Thu, 14 May 2026 16:54:05 -0700 Subject: [PATCH 2/2] fix: escape curly braces from docgens command --- cmd/api/api.go | 2 +- cmd/docgen/docgen.go | 5 ++++- cmd/docgen/docgen_test.go | 27 +++++++++++++++++++++++++++ docs/reference/commands/slack_api.md | 2 +- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/cmd/api/api.go b/cmd/api/api.go index 39e60f2c..d757edd6 100644 --- a/cmd/api/api.go +++ b/cmd/api/api.go @@ -57,7 +57,7 @@ func NewCommand(clients *shared.ClientFactory) *cobra.Command { "", "Body format is auto-detected from positional arguments:", " - Multiple key=value args: form-encoded (token in request body)", - " - Single arg starting with \\{ or \\[: JSON (Bearer token in header)", + " - Single arg starting with { or [: JSON (Bearer token in header)", " - No args: token sent in Authorization header", "", "Use --json to explicitly send a JSON body, or --data for a form-encoded body string.", diff --git a/cmd/docgen/docgen.go b/cmd/docgen/docgen.go index cd035390..148867ce 100644 --- a/cmd/docgen/docgen.go +++ b/cmd/docgen/docgen.go @@ -276,5 +276,8 @@ func render(input string) (string, error) { if err := tmpl.Execute(&buf, nil); err != nil { return "", err } - return buf.String(), nil + output := buf.String() + output = strings.ReplaceAll(output, "{", "\\{") + output = strings.ReplaceAll(output, "}", "\\}") + return output, nil } diff --git a/cmd/docgen/docgen_test.go b/cmd/docgen/docgen_test.go index a07b081b..609a6801 100644 --- a/cmd/docgen/docgen_test.go +++ b/cmd/docgen/docgen_test.go @@ -171,3 +171,30 @@ func TestNewDocsCommand(t *testing.T) { return NewCommand(clients) }) } + +func Test_render(t *testing.T) { + tests := map[string]struct { + input string + expected string + }{ + "escapes curly braces for MDX compatibility": { + input: "Single arg starting with { or [: JSON", + expected: "Single arg starting with \\{ or [: JSON", + }, + "escapes closing curly braces": { + input: "view={...}", + expected: "view=\\{...\\}", + }, + "leaves text without unexpected characters unchanged": { + input: "No unexpected characters here", + expected: "No unexpected characters here", + }, + } + for name, tc := range tests { + t.Run(name, func(t *testing.T) { + result, err := render(tc.input) + require.NoError(t, err) + assert.Equal(t, tc.expected, result) + }) + } +} diff --git a/docs/reference/commands/slack_api.md b/docs/reference/commands/slack_api.md index 30e4e8bf..b50fa875 100644 --- a/docs/reference/commands/slack_api.md +++ b/docs/reference/commands/slack_api.md @@ -11,7 +11,7 @@ Parameters are passed as key=value pairs, a JSON body, or via flags. Body format is auto-detected from positional arguments: - Multiple key=value args: form-encoded (token in request body) - - Single arg starting with \{ or \[: JSON (Bearer token in header) + - Single arg starting with \{ or [: JSON (Bearer token in header) - No args: token sent in Authorization header Use --json to explicitly send a JSON body, or --data for a form-encoded body string.