Skip to content

feat: render kato summaries per-channel (markdown|json) - #2

Merged
zufardhiyaulhaq merged 2 commits into
mainfrom
feat/summary-format-rendering
Sep 11, 2026
Merged

feat: render kato summaries per-channel (markdown|json)#2
zufardhiyaulhaq merged 2 commits into
mainfrom
feat/summary-format-rendering

Conversation

@zufardhiyaulhaq

Copy link
Copy Markdown
Member

Summary

kato now emits a summaryFormat marker (markdown or json) alongside each summary. This teaches kato-bot to read that marker and convert either format into what each chat platform needs — fixing Telegram showing raw Markdown (##, **, `) as literal characters.

  • Lark consumes Markdown natively → stays Markdown.
  • Telegram needs a restricted HTML subset → we convert to <b>/<i>/<code>/<pre>/<a> with proper escaping.

What changed

  • internal/summaryfmt (new, tested): ToMarkdown(summary, format) and ToTelegramHTML(summary, format). Handles both kato Markdown and the json {verdict, headline, blocks[]} schema. Markdown is the canonical hub: json blocks are normalized to Markdown, then Telegram HTML is produced from that single path. Code spans and links are protected so emphasis never bleeds into them; <, >, & are escaped.
  • Read the marker: summaryFormat added to the kato client, core.RunResult, and core.ServiceResult (+ threaded through the group runner).
  • Single-run result: Telegram (keyboards.go) renders HTML; Lark (cards.go) renders Markdown.
  • Group run: per-service Lark cards (groupcards.go) + the Telegram group summary (dispatch.go).

Before / after (Telegram)

Before: ## Diagnosis / **web** / - item shown literally.
After: Diagnosis (bold), web bold, • item bullets, <code>/<pre> for code, entities escaped.

Testing

  • go build ./..., go vet ./..., go test ./... — all green (existing Lark/Telegram tests included, no regressions).
  • New summaryfmt tests cover markdown→HTML, json→markdown, json→HTML, escaping, fenced code, and code-span emphasis suppression.

Pairs with gopaytech/kato#1 (the kato side that emits summaryFormat).

🤖 Generated with Claude Code

zufardhiyaulhaq and others added 2 commits September 11, 2026 16:34
kato now emits a summaryFormat marker (markdown or json) with each summary.
kato-bot reads it and converts either format into what each platform needs:
Telegram gets a restricted HTML subset (<b>/<i>/<code>/<pre>/<a>, bullets,
escaping), Lark keeps native Markdown.

- internal/summaryfmt: converter (ToMarkdown, ToTelegramHTML) handling both
  markdown and the json block schema, with HTML escaping and code/link safety
- read summaryFormat from kato (client + core.RunResult + core.ServiceResult)
- single-run result: Telegram HTML render, Lark markdown render
- group run: per-service Lark cards + the Telegram group summary

Fixes Telegram showing raw ## / ** / backtick markdown literally.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nders as markdown

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@zufardhiyaulhaq
zufardhiyaulhaq merged commit db4aa23 into main Sep 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant