-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
feat(shiki): allow custom highlighters, avoid async rehype #8320
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8320 +/- ##
==========================================
+ Coverage 76.61% 76.71% +0.09%
==========================================
Files 117 118 +1
Lines 9751 9805 +54
Branches 328 335 +7
==========================================
+ Hits 7471 7522 +51
- Misses 2278 2281 +3
Partials 2 2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the rehype-shiki plugin to support an optional pre-initialized highlighter instance, transitioning from a traditional function declaration to an arrow function pattern while improving type documentation.
Key changes:
- Refactored the plugin to accept an optional
highlighterparameter and use arrow function syntax - Fixed JSDoc syntax errors by converting
@paramto@propertyfor type definition fields - Added comprehensive type definition for
SyntaxHighlighterin the highlighter module
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/rehype-shiki/src/plugin.mjs | Refactored to arrow function syntax and updated to accept optional highlighter parameter |
| packages/rehype-shiki/src/index.mjs | Fixed JSDoc syntax by converting @param to @property for HighlighterOptions fields |
| packages/rehype-shiki/src/highlighter.mjs | Added SyntaxHighlighter typedef and return type documentation |
| packages/rehype-shiki/package.json | Bumped version from 1.2.0 to 1.3.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b7c7368 to
875b379
Compare
|
Deployment works locally, cc @nodejs/web-infra |
ce86438 to
2949616
Compare
|
PTAL @nodejs/nodejs-website |
This'll make it possible to define a custom Shiki singleton for
rehype-shikito use (ie if you want to define your Shiki instance elsewhere).It also makes Shiki a non-async rehype plugin