CodeMirror in Svelte

Can I use CodeMirror in svelte?

I expect so, but I’m not aware of any ready-made wrapper.

I made a wrapper here: GitHub - raguay/SvelteCodeMirror6: This is a test Svelte application to work on creating a CodeMirror 6 component for Svelte.

I use it in my project: GitHub - raguay/EmailIt: A Svelte and Wails program for sending quick emails, nine note pages, text manipulation with scripts, Node-Red server, and more!


Awesome work @raguay,
Can you make it like npm package? So codebase remain same and others can contribute at single source. And using it in any app would be easy. Thanks!

I’ll look into it, but I’ve never actually made an npm package. I’ll see what I need to do because it is two things: 1) make it into a Svelte component, and then 2) make it into a npm package.

1 Like

I made a minimal wrapper taking advantage of the Svelte store contract. I made it only for my own web apps, so some bugs are expected. I haven’t made it a GitHub repository or npm package, either. But I think the concept is clear so you can copy it to your project and extend it at your will.


Thanks for sharing @qbane, Yes that how I am working right now with @raguay 's script

Hi @raguay, I figure out how the codemirror npm packages works, So I think no need for complete svelte npm package as there can be lots of changes needed as per user’s needs. Thanks for your script, I am using it and give mention to you in the script file. Kudos!!

I saw svelte-codemirror-editor on twitter earlier this week. That may also be relevant?

1 Like

Yes, Thanks for sharing @marijn