feat: replace Prism with Shiki and add support for light/dark themes #1146
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.
✨ New Code Block Themes with Shiki
This PR replaces the existing PrismJS setup with Shiki, enabling faster, more accurate, and theme-aware syntax highlighting with support for both light and dark modes.
🔍 Why Shiki?
Themeobject to load your own theme.⚙️ How to Configure
In
contentlayer.config.ts, you can configure the default themes like this:You can directly use shiki built-in themes. you just need to replace light and dark values with fallowing.
🌗 Example: Light & Dark Themes
🔄 Update Summary
prism.cssimport fromapp/blog/[...slug]/page.tsxPre.tsxcomponent in thecomponents/folderMDXComponents.tsxto use the customPrecomponent instead of the one from Plinyrelease-of-tailwind-nextjs-starter-blog-v2.0.mdxpost with a guide for Shiki theme usageprism.cssfilecontentlayer.config.tsto remove PrismJS and integrate the@shikijs/rehypepluginpackage.jsonto remove PrismJS packages and add the Shiki rehype packagetailwind.csswith:remark-code-title(Mac-style title bar)I hope you like it.