Skip to content

Commit 533a547

Browse files
Copilotpelikhan
andcommitted
Fix markdown RPC message rendering for consistent styling
- Add backticks around "resp" to match method styling - Remove unnecessary space before newline in code block formatting - Update tests to reflect consistent backtick usage Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 3da75c6 commit 533a547

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

internal/logger/rpc_logger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func formatRPCMessageMarkdown(info *RPCMessageInfo) string {
199199
if info.Method != "" {
200200
message = fmt.Sprintf("**%s**%s`%s`", info.ServerID, dir, info.Method)
201201
} else {
202-
message = fmt.Sprintf("**%s**%sresp", info.ServerID, dir)
202+
message = fmt.Sprintf("**%s**%s`resp`", info.ServerID, dir)
203203
}
204204
}
205205

@@ -212,7 +212,7 @@ func formatRPCMessageMarkdown(info *RPCMessageInfo) string {
212212
if !isEmpty {
213213
// Valid JSON: use code block for better readability (pretty printed)
214214
// Empty line before ~~~ per markdown convention
215-
message += fmt.Sprintf(" \n\n~~~\n%s\n~~~", formatted)
215+
message += fmt.Sprintf("\n\n~~~\n%s\n~~~", formatted)
216216
}
217217
} else {
218218
// Invalid JSON: use inline backticks to avoid malformed markdown

internal/logger/rpc_logger_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func TestFormatRPCMessageMarkdown(t *testing.T) {
206206
PayloadSize: 100,
207207
Payload: `{"result":{}}`,
208208
},
209-
want: []string{"**github**←resp", "~~~", `"result"`},
209+
want: []string{"**github**←`resp`", "~~~", `"result"`},
210210
notWant: []string{`"jsonrpc"`, `"method"`},
211211
},
212212
{
@@ -218,7 +218,7 @@ func TestFormatRPCMessageMarkdown(t *testing.T) {
218218
PayloadSize: 100,
219219
Error: "Connection timeout",
220220
},
221-
want: []string{"**github**←resp", "⚠️`Connection timeout`"},
221+
want: []string{"**github**←`resp`", "⚠️`Connection timeout`"},
222222
notWant: []string{},
223223
},
224224
{
@@ -475,7 +475,7 @@ func TestLogRPCResponse(t *testing.T) {
475475
}
476476

477477
mdStr := string(mdContent)
478-
expectedInMd := []string{"**github**←resp", "⚠️`backend connection failed`"}
478+
expectedInMd := []string{"**github**←`resp`", "⚠️`backend connection failed`"}
479479
for _, expected := range expectedInMd {
480480
if !strings.Contains(mdStr, expected) {
481481
t.Errorf("Markdown log does not contain %q", expected)

0 commit comments

Comments
 (0)