Demo of using format other than HTML?

Is there a demo/example code to show loading a format other than HTML in the page?

I saw discussions saying it should be possible with format/schema, but sort of lost on how to actually implement it. My JSON is basically a mapping of portions of document that has their type [heading, paragraph, blockquote, etc], attributes [twitter type of Entities in objects] , and plain text.

Currently I run it through a ractivejs to turn it into HTML to hook it up, but would like to skip that step (if possible.)

You could write your own function that converts your format to a Node object representing the ProseMirror document it corresponds to. There’s no demo of that yet.

So on the demo page, I can copy the pm.doc and technically I should be able to take that Object and set the content to a new instance of prosemirror.

What exactly do I need to call to do that? I tried to initialize it with a reference to the object and I tried to use setDoc or setContent and failed.

You can do var doc = pm.doc to save a snapshot of the document, then ctrl-a del to clear the editor, and then pm.setDoc(doc) to restore it. (That works for me – I just tested it.) Does that answer your question?

I was missing converting my JSON with pm.schema.nodeFromJSON(myObj). After that I could use setDoc without any issues.