Skip to content

fix(chat): improve agent code block contrast - #307

Merged
XingYu-Zhong merged 1 commit into
KunAgent:developfrom
musnows:codex/fix-agent-code-block-contrast-rebased
Jun 15, 2026
Merged

fix(chat): improve agent code block contrast#307
XingYu-Zhong merged 1 commit into
KunAgent:developfrom
musnows:codex/fix-agent-code-block-contrast-rebased

Conversation

@musnows

@musnows musnows commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

中文

重提关闭的 PR #277#277 的 maintainer 评论说明代码本身没有质量问题,关闭原因是当时与 #279 的 CSS 文件改动冲突。此分支已基于最新 upstream/develop 重新 cherry-pick,当前只包含同一个代码块视觉修复提交。

改动

  • 为 Agent Markdown 的纯文本 fenced code block 增加独立的 ds-plain-code-block 样式类,避免目录树、纯文本片段看起来像普通正文。
  • 为普通 pre、高亮代码块和纯文本代码块统一增强背景、边框和内阴影。
  • 增加跨主题的 --ds-code-block-bg,让明暗主题和 ikun 主题下代码块都有明确底色。
  • 补充 StreamdownCode 单测断言,确保纯文本 fenced block 保留代码块视觉类。

处理 PR #277 评论

验证

  • npm run test -- src/renderer/src/components/chat/StreamdownCode.test.ts
  • npm run typecheck
  • git diff --check
  • npm run dist:mac:arm64
  • 解压 dist/Kun-0.1.0-mac-arm64.zip 并从 dist/Kun-0.1.0-mac-arm64-unzipped/Kun.app 启动 packaged app
  • curl http://127.0.0.1:8899/health 返回 {"status":"ok","service":"kun","mode":"serve"}
  • packaged app.asar 中确认包含 ds-plain-code-block--ds-code-block-bg

English

Re-submission of closed PR #277. The maintainer comment on #277 stated that the change itself was fine, and the PR was closed because it conflicted with CSS changes from #279 at that time. This branch cherry-picks the same visual fix on top of the latest upstream/develop.

Changes

  • Adds a dedicated ds-plain-code-block class for plain-text fenced blocks rendered by Agent Markdown, so directory trees and plain text snippets no longer blend into prose.
  • Strengthens the background, border, and inset highlight for native pre, highlighted code blocks, and plain-text code blocks.
  • Adds theme-level --ds-code-block-bg values so code blocks have a distinct surface across light, dark, and ikun themes.
  • Extends StreamdownCode test coverage for plain-text fenced blocks.

Addressing PR #277 feedback

Validation

  • npm run test -- src/renderer/src/components/chat/StreamdownCode.test.ts
  • npm run typecheck
  • git diff --check
  • npm run dist:mac:arm64
  • Unzipped dist/Kun-0.1.0-mac-arm64.zip and launched packaged app from dist/Kun-0.1.0-mac-arm64-unzipped/Kun.app
  • curl http://127.0.0.1:8899/health returned {"status":"ok","service":"kun","mode":"serve"}
  • Confirmed packaged app.asar contains ds-plain-code-block and --ds-code-block-bg

@XingYu-Zhong
XingYu-Zhong merged commit 9210d49 into KunAgent:develop Jun 15, 2026
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.

2 participants