-
-
Notifications
You must be signed in to change notification settings - Fork 487
fix(transformers): handle multi-token comments in rose-pine theme #1118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fixes shikijs#1083 The rose-pine theme tokenizes comments like '// [!code --]' into multiple tokens ('//' and ' [!code --]'), while other themes like dracula keep them as a single token. This caused transformers to fail to recognize the comment notation. Changes: - Enhanced parseComments() to detect and handle multi-token comments - Added logic to combine adjacent comment tokens when processing - Updated notation transformer to properly handle additional tokens - Added comprehensive tests for both single and multi-token scenarios The fix maintains backward compatibility with existing themes while enabling transformers to work correctly with themes that split comments.
✅ Deploy Preview for shiki-next ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for shiki-matsu ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1118 +/- ##
==========================================
+ Coverage 88.35% 88.46% +0.10%
==========================================
Files 74 74
Lines 3322 3345 +23
Branches 956 965 +9
==========================================
+ Hits 2935 2959 +24
+ Misses 344 342 -2
- Partials 43 44 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Remove Node.js 18.x from CI matrix (requires Node.js >= 19 for coverage) - Add JSX parsing and v1 algorithm test cases to improve coverage
- Add parse-comments-multi-token.test.ts to directly test the new multi-token handling code - This covers the specific code paths added for rose-pine theme compatibility
📝 Description
The rose-pine theme tokenizes comments like
// [!code --]into multiple tokens ('//'and' [!code --]'), while other themes like dracula keep them as a single token.This caused transformers to fail to recognize the comment notation.
Changes:
parseComments()to detect and handle multi-token comments✅ The fix maintains backward compatibility with existing themes while enabling transformers to work correctly with themes that split comments.
🔗 Linked Issues
Fixes #1083
💬 Additional Context
Is there anything you'd like reviewers to focus on?