Diffing extension is included in the starter extensions by default.
For usage guides, see Document comparison.
Commands
compareDocuments
Compares the current document against an updated document and returns the differences. Does not modify the document.The ProseMirror document to compare against. Typically from a headless
Editor instance.Comments from the updated document. Defaults to the current document’s comments if omitted.
OOXML styles from the updated document. Defaults to current styles if omitted.
OOXML numbering from the updated document. Defaults to current numbering if omitted.
DiffResult object containing the computed differences.
replayDifferences
Applies aDiffResult onto the current document. By default, changes are wrapped in tracked-change marks.
The diff result from
compareDocuments.When
true, changes are tagged as tracked changes with author attribution. When false, changes are applied silently. Requires a user on the editor instance.DiffResult
The object returned bycompareDocuments:
| Field | Type | Description |
|---|---|---|
docDiffs | NodeDiff[] | Block and inline structural differences |
commentDiffs | CommentDiff[] | Added, deleted, and modified comments |
stylesDiff | StylesDiff | null | OOXML style changes |
numberingDiff | NumberingDiff | null | OOXML numbering changes |
NodeDiff has an action of 'added', 'deleted', or 'modified', with serialized node data and position anchors.

