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: support shiki twoslash #120

Closed
wants to merge 3 commits into from
Closed

feat: support shiki twoslash #120

wants to merge 3 commits into from

Conversation

antfu
Copy link
Member

@antfu antfu commented Dec 27, 2023

This PR allows the highlighter to use https://github.com/antfu/shikiji/tree/main/packages/shikiji-twoslash to render TypeScript code snippets with type information.

TODO:

  • https://github.com/antfu/twoslash-cdn supports to pass an unstorage instance to cache the fetched .d.ts files across builds. But not sure how we could pass the options and instance for users to configure. Maybe a mdc.storage object like Nitro?
  • Find a way to have TwoSlash hover display even outside of the code block with overflow: hidden - This is more like a styling issue and general to Shikiji. It's non-blocking, I'll try to experiment in parallel.

Preview:
image

@antfu antfu marked this pull request as draft January 22, 2024 13:48
@antfu
Copy link
Member Author

antfu commented Jan 22, 2024

#124 might be a better solution as it would allow users to do it on the userland

@antfu
Copy link
Member Author

antfu commented Jan 25, 2024

Close in favor of #129, later I will make a module to integrate twoslash for nuxt/content and MDC

@antfu antfu closed this Jan 25, 2024
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.

None yet

1 participant