how to save text in current state

how can i keep the script saved like this? When saving the script it is all on one line and I don’t want that.

[image]
example

view.state.doc.toString() gives you the current document. But if line breaks are being stripped that probably happens outside of CodeMirror.