Skip to content

fix(web): upgrade markstream-vue to 1.0.9-beta.1 and enable Monaco code highlighting - #2415

Merged
wbxl2000 merged 2 commits into
mainfrom
fix/kimi-web-markstream-monaco
Jul 30, 2026
Merged

fix(web): upgrade markstream-vue to 1.0.9-beta.1 and enable Monaco code highlighting#2415
wbxl2000 merged 2 commits into
mainfrom
fix/kimi-web-markstream-monaco

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

What changed

  • apps/kimi-web: markstream-vue 1.0.7 → 1.0.9-beta.1, and add the optional peers it needs for enhanced rendering (stream-diffs, stream-monaco, monaco-editor) — the same set kimi-code-app added in https://github.com/MoonshotAI/kimi-code-app/pull/155.
  • codeBlockProps.monacoOptions.lineNumbers = false: chat code blocks show no gutter (line numbers eat reading width and every chat block starts at line 1), mirroring kimi-code-app.

Why

1. Fallback-rendered code blocks show line numbers overlapping the code (reported in #2347 — thanks @yicun for the accurate analysis). Root cause: in markstream-vue 1.0.7, when the Monaco enhancement is unavailable, CodeBlockNode renders its standalone fallback <pre> as the component root, but its scoped layout rules are descendant selectors that cannot match a root — the gutter renders while the code gets no gutter reservation. Fixed upstream in Simon-He95/markstream-vue#602 (plain scoped selectors that also match a component root), released in 1.0.9-beta.1. This supersedes the local-workaround approach of #2347.

2. kimi-web currently gets no enhanced highlighting at all. The 1.0.7 upgrade (425cfdf) did not add the new optional peers, so the Monaco loader always fails and every code block renders through the plain fallback. With the peers installed, blocks get real Monaco highlighting; when enhancement is unavailable, the fallback now renders correctly too.

Verification

  • pnpm --filter @moonshot-ai/kimi-web check:style (baseline, no new findings)
  • pnpm --filter @moonshot-ai/kimi-web typecheck
  • pnpm --filter @moonshot-ai/kimi-web test (653 tests)
  • pnpm --filter @moonshot-ai/kimi-web build
  • Upstream fix verified end-to-end in a minimal repro against the published 1.0.9-beta.1 build: standalone fallback computes padding-left: 45.35px (= the calc(6ch + 2px) gutter) with no overlap (before: padding-left: 0, 38px overlap).

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bc630c0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

❌ Nix build failed

Hash mismatch in pnpmDeps:

Hash
specified sha256-bL1AaInlb8dE+ua7a6llvQWkibEwEzfI3oQW5IOpX6I=
got sha256-FNxf3Zpr+s6ubtLIqXCkVgecBGejGM4hovUNVRnNoX4=

Please update flake.nix with the got hash.

@pkg-pr-new

pkg-pr-new Bot commented Jul 30, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@bc630c0
npx https://pkg.pr.new/@moonshot-ai/kimi-code@bc630c0

commit: bc630c0

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 67f2ae3838

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

showCollapseButton: false,
showFontSizeButtons: false,
loading: false,
monacoOptions: { lineNumbers: false },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Select Monaco for eligible code blocks

This only adds Monaco options/dependencies, but this component still passes :code-renderer="renderPlan.codeRenderer", and renderPlan can only produce shiki (or pre for heavy messages, with streaming forced to shiki). In normal chat messages the Monaco/stream-diffs renderer is therefore never selected, so the intended Monaco highlighting and the line-number override here do not take effect; switch the non-heavy path to the Monaco renderer if this change is meant to enable it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not accurate for markstream-vue 1.0.7+. The shiki renderer kind is a legacy name kept for compatibility — its dispatch resolves to the same Monaco-based component as the monaco kind: 'shiki'ViewportDeferredMarkdownCodeBlockNodeindex5.js (MarkdownCodeBlockNode) → imports CodeBlockNode.js (the stream-diffs/Monaco one). Verified empirically in a minimal repro: with code-renderer="shiki" the page loads both index5.js and CodeBlockNode.js and renders through the Monaco component, so the newly installed peers take effect on this exact path. codeBlockMonacoOptions is the one that only reaches the monaco kind — which is precisely why the lineNumbers override rides inside codeBlockProps (same pattern as kimi-code-app#155, which has been running code-renderer="shiki" against the Monaco component since it merged).

@wbxl2000
wbxl2000 merged commit 5c0ec29 into main Jul 30, 2026
14 checks passed
@wbxl2000
wbxl2000 deleted the fix/kimi-web-markstream-monaco branch July 30, 2026 12:02
@github-actions github-actions Bot mentioned this pull request Jul 30, 2026
Pidbid added a commit to Pidbid/kkm that referenced this pull request Jul 31, 2026
Pidbid added a commit to Pidbid/kkm that referenced this pull request Jul 31, 2026
Pidbid added a commit to Pidbid/kkm that referenced this pull request Jul 31, 2026
Pidbid added a commit to Pidbid/kkm that referenced this pull request Jul 31, 2026
Pidbid added a commit to Pidbid/kkm that referenced this pull request Jul 31, 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.

1 participant