code-hike / bright

React Server Component for syntax highlighting
https://bright.codehike.org
1.59k stars 22 forks source link

Provide a client side version? #19

Open lucgagan opened 2 years ago

lucgagan commented 2 years ago

I have a use case where some code examples need to be rendered server-side and others client-side.

It would be nice if I could use the same package for both.

tom-sherman commented 1 year ago

This should be possible without introducing another component or API, instead of using async/await the component could use(highlight()). That's what I've done in my PR here: https://github.com/tom-sherman/react-perfect-syntax-highlighter/pull/4

(note: I created that library before I knew this one existed lol)

The blocker at the moment is that cache() seems to be unimplemented/experimental on the client. In Next.js at least builds completely fail.

jzxhuang commented 1 year ago

+1, this would be great to have