feat: add code sidebar preview - #4350
Merged
Merged
Conversation
Add desktop sidebar preview for long collapsed code blocks. Stabilize PrismMac initialization after hard refresh and document the code collapse behavior.
|
@RHZHZ is attempting to deploy a commit to the tangly1024's projects Team on Vercel. A member of the Team first needs to authorize it. |
✅ Deploy Preview for notionnext-netlify ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
tangly1024
approved these changes
Aug 6, 2026
tangly1024
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the code sidebar preview implementation. Verified the focused PrismMac suite locally: yarn test tests/components/PrismMac.test.js --runInBand. Main CI, Docker, Netlify and Vercel are green; the label workflow failure is not code-related.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2941
已知问题
长代码块在正文中阅读体验较差
代码块样式在强刷后存在加载时序问题
PrismMac初始化出现解决方案
为长代码块增加桌面端侧栏预览
CODE_COLLAPSE折叠逻辑CODE_COLLAPSE_MIN_LINES的代码块显示“在侧栏查看”稳定
PrismMac初始化与样式加载顺序MutationObserver等待正文代码块 DOM 出现后再初始化/css/prism-mac-style.css移到最后改动收益
改善长代码阅读体验
提升代码块样式稳定性
具体改动
components/PrismMac.jsMutationObserver,等待代码块 DOM 出现后初始化public/css/prism-mac-style.css.code-toolbar的边框、圆角、阴影和间距themes/claude/style.js__tests__/components/PrismMac.test.jsdocs/user-guide//docs/developer/rfc/测试确认
yarn lint通过git diff --cached --check通过补充说明:本地尝试运行
yarn test "__tests__/components/PrismMac.test.js" --runInBand时,Jest 在当前 Windows.zcf路径下报No tests found,不是测试断言失败。用户文档(
docs/user-guide//docs/developer/)docs/user-guide/目录约定conf/*.config.js一致(若文档涉及配置).env、私有 ID