Am I missing something? This already exists in Google Docs. Much easier to implement when the doc is database-backed (recording every keystroke for OT) vs file-based.
Any other way to implement would probably also involve one common format (or a small few) behind the scenes.