-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
feat!: rename getHighlighter
to createHighlighter
#702
Conversation
✅ Deploy Preview for shiki-matsu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for shiki-next ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #702 +/- ##
==========================================
- Coverage 96.45% 96.31% -0.14%
==========================================
Files 70 70
Lines 5984 6056 +72
Branches 799 805 +6
==========================================
+ Hits 5772 5833 +61
- Misses 207 218 +11
Partials 5 5 ☔ View full report in Codecov by Sentry. |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [shiki](https://github.com/shikijs/shiki) ([source](https://github.com/shikijs/shiki/tree/HEAD/packages/shiki)) | [`1.7.0` -> `1.10.1`](https://renovatebot.com/diffs/npm/shiki/1.7.0/1.10.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/shiki/1.10.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/shiki/1.10.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/shiki/1.7.0/1.10.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/shiki/1.7.0/1.10.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>shikijs/shiki (shiki)</summary> ### [`v1.10.1`](https://github.com/shikijs/shiki/releases/tag/v1.10.1) [Compare Source](https://github.com/shikijs/shiki/compare/v1.10.0...v1.10.1) ##### 🐞 Bug Fixes - **rehype**: Default export use shared highlighter instance, fix [#​714](https://github.com/shikijs/shiki/issues/714) - by [@​antfu](https://github.com/antfu) in [https://github.com/shikijs/shiki/issues/714](https://github.com/shikijs/shiki/issues/714) [<samp>(c4f03)</samp>](https://github.com/shikijs/shiki/commit/c4f030d7) ##### [View changes on GitHub](https://github.com/shikijs/shiki/compare/v1.10.0...v1.10.1) ### [`v1.10.0`](https://github.com/shikijs/shiki/releases/tag/v1.10.0) [Compare Source](https://github.com/shikijs/shiki/compare/v1.9.1...v1.10.0) ##### 🚀 Features - Introduce `GrammarState` - by [@​antfu](https://github.com/antfu) in [https://github.com/shikijs/shiki/issues/712](https://github.com/shikijs/shiki/issues/712) [<samp>(8a8fa)</samp>](https://github.com/shikijs/shiki/commit/8a8faf9f) - Expose `getLastGrammarState` shorthand - by [@​antfu](https://github.com/antfu) [<samp>(f2b39)</samp>](https://github.com/shikijs/shiki/commit/f2b39561) - Update themes and grammars - by [@​antfu](https://github.com/antfu) [<samp>(02bf0)</samp>](https://github.com/shikijs/shiki/commit/02bf0179) ##### 🐞 Bug Fixes - Expose `createCssVariablesTheme` in `shiki/core` to avoid side-effects - by [@​antfu](https://github.com/antfu) [<samp>(abe63)</samp>](https://github.com/shikijs/shiki/commit/abe639d9) ##### [View changes on GitHub](https://github.com/shikijs/shiki/compare/v1.9.1...v1.10.0) ### [`v1.9.1`](https://github.com/shikijs/shiki/releases/tag/v1.9.1) [Compare Source](https://github.com/shikijs/shiki/compare/v1.9.0...v1.9.1) ##### 🚀 Features - Remove notation escape - by [@​sor4chi](https://github.com/sor4chi) in [https://github.com/shikijs/shiki/issues/709](https://github.com/shikijs/shiki/issues/709) [<samp>(dbc1f)</samp>](https://github.com/shikijs/shiki/commit/dbc1fa1d) ##### [View changes on GitHub](https://github.com/shikijs/shiki/compare/v1.9.0...v1.9.1) ### [`v1.9.0`](https://github.com/shikijs/shiki/releases/tag/v1.9.0) [Compare Source](https://github.com/shikijs/shiki/compare/v1.8.0...v1.9.0) ##### 🚨 Breaking Changes - Rename `getHighlighter` to `createHighlighter` - by [@​antfu](https://github.com/antfu) in [https://github.com/shikijs/shiki/issues/702](https://github.com/shikijs/shiki/issues/702) [<samp>(faf3b)</samp>](https://github.com/shikijs/shiki/commit/faf3bd2f) ##### [View changes on GitHub](https://github.com/shikijs/shiki/compare/v1.8.0...v1.9.0) ### [`v1.8.0`](https://github.com/shikijs/shiki/releases/tag/v1.8.0) [Compare Source](https://github.com/shikijs/shiki/compare/v1.7.0...v1.8.0) ##### 🚀 Features - **core**: Expose `dispose` function - by [@​antfu](https://github.com/antfu) in [https://github.com/shikijs/shiki/issues/707](https://github.com/shikijs/shiki/issues/707) [<samp>(2c5b3)</samp>](https://github.com/shikijs/shiki/commit/2c5b3873) ##### [View changes on GitHub](https://github.com/shikijs/shiki/compare/v1.7.0...v1.8.0) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/ariakit/ariakit). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MTMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjQyMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
shikijs/shiki#702 has more details about the upstream deprecation and change.
shikijs/shiki#702 has more details about the upstream deprecation and change.
The function name
getHighlighter
, inherited from Shiki v0.x, which is somehow confusing. While it is supposed to be a singleton, we see people using it incorrectly in components or loops:While we improved the docs in 412fe10, I think the confusing still down to the name prefix
get
reads like it will retrieve the global instance, while it actually not. In the actual behavior, it's more likecreate
a new instance every time calling the function, thus this PR propose renaming:getHighlighter
tocreateHighlighter
getHighlighterCore
tocreateHighlighterCore
getShikiInternal
tocreateShikiInternal
Alternatively, we encourage users to use
getSingletonHighlighter
instead, where it holds the singleton instance underneath, and loads new themes/languages automatically.Changes rolling out plan
createHighlighter
getSingletonHighlighter
functions. All docs change tocreate*
version. APIs likegetHighlighter
are shims to behave like before, but marked as deprecate on the type level.getHighlighter
etc.