fix: restore Shiki syntax highlighting for reused token colors#573
fix: restore Shiki syntax highlighting for reused token colors#573brendanjryan merged 4 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a18cac5401
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const css = Array.from( | ||
| blockRules, | ||
| ([cls, style]) => `.${cls}{${style}}`, | ||
| ).join(""); |
There was a problem hiding this comment.
Canonicalize emitted rule order before joining CSS
The new data-shiki-css generation uses blockRules insertion order, which depends on the first token color encountered in each block. Two blocks that use the same set of classes in different token orders therefore emit different CSS strings, and the runtime dedupe (seen.has(css) in injectShikiColors) no longer collapses them. In pages with many code blocks or after client-side navigation, this causes repeated duplicate rules to accumulate in the shared <style> tag and degrades render performance; sorting by class name (or deduping per rule) before join keeps dedupe effective.
Useful? React with 👍 / 👎.
Summary
Fixes a bug which resulted in styles being dropped due to a shiki optimization