Skip to content

chore(examples): regenerate WeChat 构建npm fixture for the new build - #13

Merged
Div627 merged 1 commit into
mainfrom
chore/wechat-example-fixture
Jul 7, 2026
Merged

chore(examples): regenerate WeChat 构建npm fixture for the new build#13
Div627 merged 1 commit into
mainfrom
chore/wechat-example-fixture

Conversation

@Div627

@Div627 Div627 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

Companion to #12 (Alipay real-device KaTeX fonts + streaming fixes). Stacked on #12 — merge after it.

💡 Background and Solution

Regenerates the checked-in WeChat 构建npm fixture (examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini) from the rebuilt package, so the WeChat example opens in the IDE without a manual 构建npm step and runs the new code: the shared CDN KaTeX loader (shared/loadKatexFonts.js), the reflow-once flicker fix, atomic list markers, and the removed base64 katex-font-data.js + plugins/Latex/fonts.wxss.

Build output only — no library source in this PR. Personal IDE config (project.config.json appid, project.private.config.json) is intentionally excluded. The examples/*/package.json dependency version bump is handled in the release step once the beta is published.

📝 Change Log

Language Changelog
🇺🇸 English --
🇨🇳 Chinese --

Refresh the checked-in examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini
fixture from the rebuilt package so the WeChat example opens without a manual
构建npm step and exercises the new code: shared CDN KaTeX loader
(shared/loadKatexFonts.js), reflow-once flicker fix, atomic list markers, and
the dropped base64 katex-font-data.js + plugins/Latex/fonts.wxss.

Build output only — no library source change. Stacks on the library fix
(#12); merge after it. The example dependency version bump is handled at
release time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 50 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: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 5b4f21f7-560a-4423-8328-c06d76114f3a

📥 Commits

Reviewing files that changed from the base of the PR and between ddcc316 and 09c89ef.

📒 Files selected for processing (15)
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/components/Markdown/index.js
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/components/MiniNodeRenderer/index.js
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/components/MiniNodeRenderer/index.wxml
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/components/MiniNodeRenderer/index.wxs
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/components/MiniNodeRenderer/index.wxss
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/es/Markdown/index.js
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/es/MiniNodeRenderer/index.js
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/es/MiniNodeRenderer/index.wxml
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/es/MiniNodeRenderer/index.wxs
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/es/MiniNodeRenderer/index.wxss
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/index.js
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/katex-font-data.js
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/plugins/Latex/fonts.wxss
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/plugins/Latex/index.js
  • examples/wechat/miniprogram_npm/@ant-design/x-markdown-mini/shared/loadKatexFonts.js

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request refactors KaTeX font loading by extracting the logic into a shared loadKatexFonts.js module, which is now utilized across both the Markdown and MiniNodeRenderer components. It also introduces a segClassOf helper to prevent visual gaps in inline code during streaming animations, adds polyfills for Array.prototype.at and String.prototype.at, and implements a blockStart function for block KaTeX tokens. Feedback on these changes highlights that onKatexFontsReady fails to execute the callback if fonts are already loaded, and that hasKatexNodes should use Array.isArray to safely handle non-array inputs and avoid potential runtime errors.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +195 to +199
function onKatexFontsReady(cb) {
ensureKatexFonts();
if (ready) return;
readyCallbacks.push(cb);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

If ready is already true (e.g., after fonts have successfully loaded or if the API is resolved as null), calling onKatexFontsReady(cb) will return immediately without ever executing the callback cb. This means any components or features relying on this callback after the initial load will never run.

We should execute the callback immediately (using callSafe(cb)) if ready is true.

function onKatexFontsReady(cb) {
  ensureKatexFonts();
  if (ready) {
    callSafe(cb);
    return;
  }
  readyCallbacks.push(cb);
}

Comment on lines +52 to +54
function hasKatexNodes(nodes) {
return !!nodes && nodes.some((node) => !!node && (String((node.attrs || {}).class || "").indexOf("katex") > -1 || hasKatexNodes(node.children)));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using !!nodes is not fully safe if nodes is passed as a non-array object (e.g., {}), which would cause nodes.some to throw a TypeError. Using Array.isArray(nodes) is a safer and more robust check to prevent potential runtime crashes.

Suggested change
function hasKatexNodes(nodes) {
return !!nodes && nodes.some((node) => !!node && (String((node.attrs || {}).class || "").indexOf("katex") > -1 || hasKatexNodes(node.children)));
}
function hasKatexNodes(nodes) {
return Array.isArray(nodes) && nodes.some((node) => !!node && (String((node.attrs || {}).class || "").indexOf("katex") > -1 || hasKatexNodes(node.children)));
}

Comment on lines +52 to +54
function hasKatexNodes(nodes) {
return !!nodes && nodes.some((node) => !!node && (String((node.attrs || {}).class || "").indexOf("katex") > -1 || hasKatexNodes(node.children)));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using !!nodes is not fully safe if nodes is passed as a non-array object (e.g., {}), which would cause nodes.some to throw a TypeError. Using Array.isArray(nodes) is a safer and more robust check to prevent potential runtime crashes.

Suggested change
function hasKatexNodes(nodes) {
return !!nodes && nodes.some((node) => !!node && (String((node.attrs || {}).class || "").indexOf("katex") > -1 || hasKatexNodes(node.children)));
}
function hasKatexNodes(nodes) {
return Array.isArray(nodes) && nodes.some((node) => !!node && (String((node.attrs || {}).class || "").indexOf("katex") > -1 || hasKatexNodes(node.children)));
}

@Div627
Div627 merged commit 35aa708 into main Jul 7, 2026
7 of 8 checks passed
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