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: migrate to shikiji #27

Merged
merged 3 commits into from
Sep 7, 2023
Merged

feat: migrate to shikiji #27

merged 3 commits into from
Sep 7, 2023

Conversation

antfu
Copy link
Member

@antfu antfu commented Sep 7, 2023

close #25

Migrating to shikiji provides a few benefits.

  • It works for CF workers, meaning it will allow apps using this module to deploy on edge
  • shikiji uses hast internally, so we can get rid of the conversation code
  • shikiji has multiple themes supported built-in (actually very similar to what we have here!), allowing us to reduce the complexity
  • Now it has builtin mdc grammar

This might be a minor breaking change to the internal types and structure, but it shouldn't affect end users' code base.

@farnabaz
Copy link
Collaborator

farnabaz commented Sep 7, 2023

Looks perfect, only one thing seems missing in shikiji.
Some Shiki themes adds font-styles to tokens (like material-theme-palenight). Merging this will create a breaking change in content module. See: nuxt/content#2079

I think this feature should implement in shikiji.

@antfu
Copy link
Member Author

antfu commented Sep 7, 2023

Oh yeah, it was in my backlog, I will check

.filter(color => color !== 'default')
.map(color => [
`html.${color} .shiki,`,
`html.${color} .shiki span {`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we should make this tiggering class configureable

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had this for a long time, let's keep it and will might drop it in a major version.(otherwise we will introduce breaking change in content)

@antfu
Copy link
Member Author

antfu commented Sep 7, 2023

Ok, font-style fixed

@farnabaz farnabaz merged commit 2a749af into main Sep 7, 2023
2 checks passed
@antfu antfu deleted the feat/shiki branch September 7, 2023 23:02
@farnabaz farnabaz mentioned this pull request Sep 19, 2023
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.

Migrate to Shikiji
2 participants