Glow syntax highlighter support
Is your feature request related to a problem? Please describe.
There are several features I miss in shiki while creating presentations with slides
- Highlight separate tokens (usually words)
- Highlight errors
Describe the solution you'd like
There is a new player in the field of markdown highlighters: glow. It supports these features and many languages.
As far as I can see current solutions only support line highlighting
Good to know, Glow - thanks for introducing it!
First, to your desired features:
Highlight separate tokens (usually words)
You could, Shiki has a very powerful transformer API - for example: https://shiki.style/packages/transformers#transformernotationwordhighlight
Highlight errors
You could do it as well. Probably much more powerful than Glow as far as I see:
- https://twitter.com/antfu7/status/1754538968421417219
- https://twitter.com/antfu7/status/1745875530275070054
- https://sli.dev/guide/syntax#twoslash-integration
While tbh, they both has certain complexity to set up, it would be actually an integration issue about how we could find a easy way to configure and animate with the clicks system etc. But I also see there shouldn't be any blocker preventing you from doing it on the userland today as Slidev exposes the transformer configs: https://sli.dev/custom/highlighters#configure-shiki (just might not be very easy)
About Glow - while at first glance it seems to be a good idea, after digging in - it doesn't seem to be a very solid solution (https://github.com/nuejs/nue/blob/master/packages/glow/src/glow.js) - it's a hard-coded regex-based solution. This provides rather a rough highlighting result, which to me, fall into the similar category as Prism.js. But as it seems to be more lightweight and modern than Prism, I don't mind to actually support it as long as the integration and maintenance do not take too much effort. But as this is still an integration problem, I don't think word and errors highlight would just work especially if you want to have some animations around them or so.
@antfu thanks a lot for the meaningful answer! I have to agree with your points, it seems this feature should be closed/deprioritized and another one, for "more interesting" highlights, should be created. On it.