Skip to content

fix(shared): 修复 CJK Markdown 行内渲染 - #1417

Merged
DeliciousBuding merged 1 commit into
masterfrom
fix/cjk-markdown-rendering
Jul 26, 2026
Merged

fix(shared): 修复 CJK Markdown 行内渲染#1417
DeliciousBuding merged 1 commit into
masterfrom
fix/cjk-markdown-rendering

Conversation

@DeliciousBuding

Copy link
Copy Markdown
Collaborator

变更

  • 使用 remark-cjk-friendly/parseOnly 修复 CJK 标点相邻的 emphasis 解析
  • 仅对 source-confirmed GFM HTTP(S) 裸链接拆出中文尾标点,保留显式链接、百分号编码和配对 CJK 括号
  • 以块级尾换行识别 code block,长 inline code 与源码跨行 code span 保持行内,并用 box-decoration-break: clone 保持换行片段背景/圆角
  • 删除临时 dump 测试,补充 CJK、英文、GFM、安全与 inline/block 回归测试

根因与影响

CommonMark 的 delimiter flanking 规则会让 CJK 句末标点附近的 emphasis 失效;GFM 裸链接会把未识别的 CJK 句读继续吞入 URL;原有 <code> 组件又按长度和换行内容判断 block,导致长行内代码不能稳定换行展示。本修复集中在 shared Markdown renderer,Desktop/Web 共用。

验证

  • app/shared: Vitest 165 files / 1264 tests passed
  • app/shared: Markdown 定向测试 18/18 passed
  • app/desktop: pnpm build passed(含 TypeScript + Vite)
  • app/web: pnpm build passed(含 TypeScript + Vite)
  • git diff --check passed
  • shared 独立 pnpm lint 仍命中既有 story/test/demo 类型基线;本次文件无新增诊断,两个 consumer 的 TypeScript production build 均通过

Closes #1409

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@DeliciousBuding, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 26 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8642c0ac-5db4-486f-b805-20de054552d2

📥 Commits

Reviewing files that changed from the base of the PR and between 4112867 and 1c2b858.

⛔ Files ignored due to path filters (1)
  • app/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • app/shared/package.json
  • app/shared/src/ui/Markdown.module.css
  • app/shared/src/ui/Markdown.test.tsx
  • app/shared/src/ui/Markdown.tsx
  • app/shared/src/ui/cjkRemarkPlugin.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cjk-markdown-rendering

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@DeliciousBuding
DeliciousBuding marked this pull request as ready for review July 26, 2026 19:11
Copilot AI review requested due to automatic review settings July 26, 2026 19:11

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@DeliciousBuding
DeliciousBuding merged commit 45b6c69 into master Jul 26, 2026
20 checks passed
@DeliciousBuding
DeliciousBuding deleted the fix/cjk-markdown-rendering branch July 26, 2026 19:12
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.

front: CJK markdown 渲染正确性 — 标点旁 emphasis 失效 / autolink 吞尾标点 / inline code 跨行断裂

2 participants