Jupyter has an API for writing your own storage back-end, and I whipped up a prototype to store as regular python files, except adding a space after the first character in any line matching /#[ ]*#/ and putting all of the Jupyter metadata on lines beginning ##. Stripping out the metadata and getting back the original formatting means just removing all lines beginning ##, and removing the second character in every line matching /#[ ]+#/. Unfortunately, under my setup, I had lots of trouble with Jupyter timing out its calls to my storage back-end, likely due to running on a heavily loaded virtualized host.