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

Consider using Shiki for syntax highlighting #58

Open
uncenter opened this issue Nov 17, 2024 · 7 comments · May be fixed by #64
Open

Consider using Shiki for syntax highlighting #58

uncenter opened this issue Nov 17, 2024 · 7 comments · May be fixed by #64
Labels

Comments

@uncenter
Copy link

Hi! Thanks as always for this great project. I'm wondering if you would consider switching to Shiki instead of Prism for syntax highlighting. The project is frequently updated, maintained, and far more featureful. You can use any VS Code theme with it, and it supports far more precise highlighting for tokens than Prism allows for. Shiki has powerful "transformers" and many good default transformers for customization (https://shiki.style/packages/transformers).

You can use the https://shiki.style/packages/markdown-it plugin to integrate it easily with Eleventy.

@rothsandro
Copy link
Owner

Thanks for the suggestion. Improving syntax highlighting was on my todo list anyway as the current theme has insufficient contrast. I'll give Shiki a try.

@rothsandro
Copy link
Owner

Too bad that Shiki doesn't support Nunjucks as language 😞 Just checked your repo and you just use HTML for that. That works, but it's not perfect and also a breaking change if someone currently uses codeblocks with njk as lang.

@uncenter
Copy link
Author

Doesn't appear that Prism does either? I see a Jinja/Django entry though if that's what you mean. Shiki has that as well.

@rothsandro
Copy link
Owner

Doesn't appear that Prism does either? I see a Jinja/Django entry though if that's what you mean. Shiki has that as well.

Ah, the Eleventy plugin registered njk as an alias for Jinja. So I could do the same with Shiki.

@rothsandro rothsandro linked a pull request Nov 22, 2024 that will close this issue
@rothsandro
Copy link
Owner

I created a first prototype with Shiki. I love the new theme but slow performance (shikijs/shiki#846) is blocking me right now 😕

@uncenter
Copy link
Author

Huh strange, I haven't experienced anything like that. How does using the default markdown-it setup perform?

@rothsandro
Copy link
Owner

You mean the default @shikijs/markdown-it setup? That's also slow (~50s). Sure, we are talking about ~1300 files but prism was much faster with the same number of files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants