Skip to content

chore(web): upgrade markstream-vue to 1.0.7 - #2294

Merged
wbxl2000 merged 5 commits into
mainfrom
chore/upgrade-markstream-vue-1.0.7
Jul 28, 2026
Merged

chore(web): upgrade markstream-vue to 1.0.7#2294
wbxl2000 merged 5 commits into
mainfrom
chore/upgrade-markstream-vue-1.0.7

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

问题

0.29.2 用户反馈 web 端代码块行号错乱(无 header、行号与代码错位、顶部行被裁切、尾部幻影行号)。

根因

markstream-vue 1.0.4 的异步代码块加载占位组件(CodeBlockNodeLoading → 裸 PreCodeNode)落在样式盲区:

  1. markstream 侧 pre.code-pre-fallback 的样式是 CodeBlockNode 的 scoped :deep() 规则,占位组件由 NodeRenderer 直接渲染、不在该 scope 内 → 规则不命中;
  2. kimi-web 的 pre 样式又主动排除了行号 pre → 占位 pre 以正文比例字体、padding 0 渲染,代码压进行号槽;
  3. 预留高度按「21px/行 + 32px padding + 40px header」估算,与实际(无 header、~24px/行)不符 → 内容超高变成内部滚动,顶部行被裁。

该占位态在 chunk 加载慢/卡住时(如 plain HTTP 自托管)会持续可见。

修复

升级 markstream-vue 到 1.0.7:

  • 1.0.6:新增非 scoped 的 .markstream-vue pre.code-pre-fallback[data-markstream-code-loading="1"] 规则,占位态样式自包含(等宽字体、行号槽 padding、背景);
  • 1.0.7:占位组件改用不含 header 的 estimatedContentHeightPx,并重做占位显示逻辑,修复预留高度错配。

遗留(上游未修,不影响本 PR 结论)

幻影行号:PreCodeNode.getDisplayCode 只 strip 一个尾换行,代码块末尾多个空行时会多出行号(需 markstream upstream 修复,建议 /(\r\n|\n|\r)+$/)。

验证

  • 本地对照 1.0.4/1.0.5/1.0.6/1.0.7 四个版本的 dist 产物逐条核实了上述改动点
  • 升级后建议回归验证代码块渲染(1.0.5→1.0.7 间 CodeBlock 有 diff 预览等改动)

Fix garbled code-block line numbers reported on 0.29.2: the async
code-block loading fallback rendered unstyled (proportional font,
code overlapping the line-number gutter) and with an over-estimated
reserved height that clipped leading lines. markstream-vue 1.0.6 adds
self-contained fallback styles and 1.0.7 fixes the height estimate.
@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dc83015

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 28, 2026

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

commit: dc83015

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

❌ Nix build failed

Hash mismatch in pnpmDeps:

Hash
specified sha256-yzrN/1igHpQwws0gf3J1lgto+7CtHw2ULPB9Fyb9ySE=
got sha256-k2McTzqvLoSzXQwwHJYdzA4prhJUlOa4JKbDektSHiA=

Please update flake.nix with the got hash.

@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: 415041446c

ℹ️ 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".

Comment thread pnpm-lock.yaml Outdated
'@tailwindcss/vite':
specifier: ^4.1.4
version: 4.1.18(vite@6.4.2(@types/node@22.19.17)(jiti@2.6.1)(lightningcss@1.32.0)(tsx@4.21.0)(yaml@2.8.3))
version: 4.1.18(vite@6.4.2(@types/node@22.19.17)(jiti@2.6.1)(lightningcss@1.33.0)(tsx@4.21.0)(yaml@2.8.3))

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 Scope the lockfile update to markstream

When this patch is used to build or test non-web workspaces, the lockfile now also refreshes their toolchains—for example apps/kimi-inspect resolves Vite through lightningcss@1.33.0 despite no change to that workspace, and similar unrelated churn appears elsewhere in the lockfile. That makes a web renderer patch carry unverified dependency updates outside apps/kimi-web; please regenerate the lockfile so only the markstream-vue graph changes, or split the broader dependency refresh into its own verified change.

Useful? React with 👍 / 👎.

wbxl2000 added 2 commits July 28, 2026 04:55
Regenerate pnpm-lock.yaml with a plain install so only markstream-vue
and its transitive deps move (markdown-it-ts, stream-markdown-parser,
etc.); unrelated toolchains (e.g. lightningcss in kimi-inspect) stay
pinned as before. Addresses review feedback.
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@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: 063f082baf

ℹ️ 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".

"@moonshot-ai/kimi-code": patch
---

web: Upgrade markstream-vue to 1.0.7 to fix garbled line numbers in code blocks. The async code-block loading fallback was unstyled in 1.0.4 (proportional font, code overlapping the line-number gutter) and used an over-estimated reserved height that clipped leading lines; 1.0.6 ships self-contained fallback styles and 1.0.7 fixes the height estimate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3 Badge Shorten the release-note entry

The repository's changeset workflow points these files to .agents/skills/gen-changesets/SKILL.md, whose wording rules require concise user-facing entries; this line will be copied into the CLI changelog and currently exposes upstream version-by-version implementation details rather than a short web-facing fix. Please condense it to a single web: sentence such as fixing garbled line numbers in code blocks.

Useful? React with 👍 / 👎.

@wbxl2000
wbxl2000 merged commit 425cfdf into main Jul 28, 2026
14 checks passed
@wbxl2000
wbxl2000 deleted the chore/upgrade-markstream-vue-1.0.7 branch July 28, 2026 05:25
@github-actions github-actions Bot mentioned this pull request Jul 28, 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