JupyterLab State Persistence

Hello, I am currently building an extension for JupyterLab that involves saving and reusing code snippets. One of the features of my extension involves code snippets getting highlighted when they are pasted into a notebook. I currently have that functionality working via extending CodeMirror.

One problem I am currently stuck on as of right now is making the highlighted cells persist on reload. Any guidance or potential tips?

CodeMirror itself does not concern itself with cross-reload state at all. But you might look to see if JupyterLab provides any interfaces for this. Or failing that, just put your state in localStorage.