svhighlight
svhighlight copied to clipboard
Reactivity not working
Maybe I'm misreading the docs, but when passing in state that changes, the code blocks do not reflect the change. I'm using svelte five runes.
Hi, I actually haven't updated this library in quite a while and I'm not yet sure if I will. There are now some much better solutions than highlight.js, so you might consider trying out shiki instead. It also shouldn't be too difficult to set up and style. Skeleton for example has a guide on it: https://next.skeleton.dev/docs/integrations/code-block/svelte
@SylvanFranklin I had a similar problem, namely with the code prop. The main value for me in using svhighlight is that focus, blurring etc. was already done very well here. I understand I can do the same with shiki, but that's not an effort I wanted to make.
So I came up with a rudimentary implementation of reactivity under Svelte 5 (with my quite limited knowledge of Svelte). It probably has more changes than necessary, because there was a lot of trial-and-error involved. But in the end it works for me, so I'm sharing it here in case someone wants something similar.
https://github.com/katafrakt/svhighlight/tree/code-reactivity
Thanks fam, I'll definitely check this out because you're right this repo did a lot right.
@bennymi any plans to add maintainers or support svelte 5? This seems like a really nice library.
@niemyjski Since there seems to be some interest in it, I'll try updating it to Svelte 5, but it might take some time since I'm busy with work and some other projects. It would also be using shiki instead of highlightjs, so the API might change a bit.