Support with Sandpack Editor
Sandpack by CodeSandbox supports passing a custom editor function
Here's example with Monaco Editor - https://sandpack.codesandbox.io/docs/guides/integrate-monaco-editor
I think it should be possible to use this with Sandpack. We might have to export onChange function on CodeBlock component. I'll give it a try if I get some time.
We can give this a try, but it'll require some way to allow user to edit code within the code block while still preserving syntax highlighting. (I can hear horrifying screams of contenteditable attribute 🙈)
I'm not sure how features like line highlighting / word highlighting will work in a code block like this. Maybe it can allow the initial code set by the author to be highlighted as usual, but when the user edits the code, the highlighting goes away.
but it'll require some way to allow user to edit code within the code block while still preserving syntax highlighting
oh yes tried that. This will be tricky.
Maybe it can allow the initial code set by the author to be highlighted as usual, but when the user edits the code, the highlighting goes away.
Aha this is good idea! Normally I have seen line highlighting work only on static code but in live-editor the line highlighting is disabled.