Skip to content

Conversation

@ish1416
Copy link

@ish1416 ish1416 commented Nov 10, 2025


📝 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:

  • 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.


🔗 Linked Issues

Fixes #1083


💬 Additional Context

Is there anything you'd like reviewers to focus on?

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.
@netlify
Copy link

netlify bot commented Nov 10, 2025

Deploy Preview for shiki-next ready!

Name Link
🔨 Latest commit b6e28ca
🔍 Latest deploy log https://app.netlify.com/projects/shiki-next/deploys/69116bb0fc3e800008039625
😎 Deploy Preview https://deploy-preview-1118--shiki-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Nov 10, 2025

Deploy Preview for shiki-matsu ready!

Name Link
🔨 Latest commit b6e28ca
🔍 Latest deploy log https://app.netlify.com/projects/shiki-matsu/deploys/69116bb01e66160008384785
😎 Deploy Preview https://deploy-preview-1118--shiki-matsu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.46%. Comparing base (5068b26) to head (b6e28ca).

Files with missing lines Patch % Lines
...es/transformers/src/shared/notation-transformer.ts 63.63% 3 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Transformers do not work with rose-pine theme

1 participant