An introduction to the basics of CodeMirror 6

I started working with CodeMirror 6 in July '22 and have been very impressed by its API! However, I found that the learning curve was pretty steep. After spending many hours staring at the docs and source code, I felt like I had something to offer, so I wrote up an introductory article to CM6. The article covers (with practical examples):

  • Structure & lifecycle
  • Extensions
  • CodeMirror “primitives”
    • Facet
    • StateField
    • ViewPlugin
    • Decoration

The article isn’t meant to be a replacement for the system guide, but is a more in-depth look at some of these concepts and an attempt to explain them in a simple way. Hopefully this is useful!

Note: I know that this is self-promotion, but my intent is to help folks new to CM6 have a resource to help them get started (the resource I wish I would have had). From what I can tell, this discussion board is the best place to share this information. If this is disallowed, I’m happy to delete this post.


Thanks for publishing that! Posting stuff like this here is definitely not a problem.

1 Like