-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
perf: use Shiki shorthand #2026
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for slidev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
create-slidev
@slidev/parser
@slidev/cli
@slidev/client
@slidev/types
create-slidev-theme
commit: |
@@ -57,8 +57,7 @@ export type ShikiSetupReturn = | |||
& CodeOptionsThemes<BuiltinTheme> | |||
& CodeOptionsMeta | |||
& { | |||
setup: (highlighter: Highlighter) => Awaitable<void> |
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.
It seems that this function is never called. And I don't know how to support it because there's no longer a Highlighter
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.
We can get the highlighter with:
const shiki = createSingletonShorthands<string, string>(createHighlighter)
const highlighter = await shiki.getSingletonHighlighter()
But I don't mind removing it if no one uses it
// trigger the shiki to load the langs | ||
shiki.codeToHast('', { lang: 'js', ...shikiOptions }), | ||
shiki.codeToHast('', { lang: 'ts', ...shikiOptions }), |
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.
This is an ugly workaround 🥲
I tried passing lang
and langAlias
to transformerTwoslash
, but it either complains "language not loaded" or doesn't transform the code.
This speeds up the demo slides' start-up time (from running the command to printing the URLs) by almost 2s on my machine.