-
-
Notifications
You must be signed in to change notification settings - Fork 382
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(core): pass raw token to transformer.span
api
#782
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for shiki-next ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for shiki-matsu ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
antfu
approved these changes
Sep 26, 2024
antfu
changed the title
feat: pass raw token to transformer.span api
feat(core): pass raw token to transformer.span api
Sep 26, 2024
antfu
changed the title
feat(core): pass raw token to transformer.span api
feat(core): pass raw token to Sep 26, 2024
transformer.span
api
chgeo
referenced
this pull request
in cap-js/docs
Sep 26, 2024
…#1281) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@shikijs/vitepress-twoslash](https://redirect.github.com/shikijs/shiki) ([source](https://redirect.github.com/shikijs/shiki/tree/HEAD/packages/vitepress-twoslash)) | [`1.18.0` -> `1.19.0`](https://renovatebot.com/diffs/npm/@shikijs%2fvitepress-twoslash/1.18.0/1.19.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@shikijs%2fvitepress-twoslash/1.19.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@shikijs%2fvitepress-twoslash/1.19.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@shikijs%2fvitepress-twoslash/1.18.0/1.19.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@shikijs%2fvitepress-twoslash/1.18.0/1.19.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>shikijs/shiki (@​shikijs/vitepress-twoslash)</summary> ### [`v1.19.0`](https://redirect.github.com/shikijs/shiki/releases/tag/v1.19.0) [Compare Source](https://redirect.github.com/shikijs/shiki/compare/v1.18.0...v1.19.0) ##### 🚀 Features - Introduce warning system for deprecated API - by [@​antfu](https://redirect.github.com/antfu) in [https://github.com/shikijs/shiki/issues/788](https://redirect.github.com/shikijs/shiki/issues/788) [<samp>(4e59b)</samp>](https://redirect.github.com/shikijs/shiki/commit/4e59b65d) - **core**: - Pass raw token to `transformer.span` api - by [@​zzuu666](https://redirect.github.com/zzuu666) in [https://github.com/shikijs/shiki/issues/782](https://redirect.github.com/shikijs/shiki/issues/782) [<samp>(bba45)</samp>](https://redirect.github.com/shikijs/shiki/commit/bba452c4) - Support object style `htmlStyle` in themed token, support new `htmlAttrs` - by [@​antfu](https://redirect.github.com/antfu) [<samp>(85a4f)</samp>](https://redirect.github.com/shikijs/shiki/commit/85a4ff94) ##### [View changes on GitHub](https://redirect.github.com/shikijs/shiki/compare/v1.18.0...v1.19.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 was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/cap-js/docs). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Sometimes, we need to process some information in
transformer.tokens
and then record some additional information in thetoken
, which will later be processed into the tokenNode in thetransformer.span
for rendering in HTML.For example, I need to add a background color to tokens within a specific range. I need to split the tokens in
transformer.tokens
and add special markers, but I can't easily render these markers intransformer.span
.Now I am using the modified
tokenNode.htmlStyle
field to workaround, but I feel that exposing it intransformer.span
would be better.Linked Issues
No linked issue
Additional context
If you feel that this PR does not align with Shiki's design philosophy, you can close it, thanks