Convert each document source (markdown, user edits, GitHub content) into a TipTap JSON tree, load each into a separate Y.Doc via mergeDocument, then call Y.applyUpdate to merge one into the other. Yjs CRDT semantics guarantee both sets of changes survive. Read the result back as TipTap JSON with yDocToJson.
markdown A ──► toTipTap() ──► TipTapNode ──► mergeDocument(doc1, ...) ──┐
├─► Y.applyUpdate(doc1, update2)
markdown B ──► toTipTap() ──► TipTapNode ──► mergeDocument(doc2, ...) ──┘ │