Skip to content
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
merged 1 commit into from
Sep 26, 2024

Conversation

zzuu666
Copy link
Contributor

@zzuu666 zzuu666 commented Sep 19, 2024

Description

Sometimes, we need to process some information in transformer.tokens and then record some additional information in the token, which will later be processed into the tokenNode in the transformer.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 in transformer.span.

Now I am using the modified tokenNode.htmlStyle field to workaround, but I feel that exposing it in transformer.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

Copy link

netlify bot commented Sep 19, 2024

Deploy Preview for shiki-next ready!

Name Link
🔨 Latest commit 7d844d9
🔍 Latest deploy log https://app.netlify.com/sites/shiki-next/deploys/66ec6110a64252000982951a
😎 Deploy Preview https://deploy-preview-782--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 site configuration.

Copy link

netlify bot commented Sep 19, 2024

Deploy Preview for shiki-matsu ready!

Name Link
🔨 Latest commit 7d844d9
🔍 Latest deploy log https://app.netlify.com/sites/shiki-matsu/deploys/66ec61103a5ac6000876ee5d
😎 Deploy Preview https://deploy-preview-782--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 site configuration.

@antfu 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 antfu changed the title feat(core): pass raw token to transformer.span api feat(core): pass raw token to transformer.span api Sep 26, 2024
@antfu antfu merged commit bba452c into shikijs:main Sep 26, 2024
11 checks passed
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 (@&#8203;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
[@&#8203;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
[@&#8203;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 [@&#8203;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>
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.

2 participants