Skip to content

Derive semantic Markdown changes - #9043

Closed
hweihwang wants to merge 1 commit into
nextcloud:mainfrom
hweihwang:review/structured-markdown-comparison-model
Closed

Derive semantic Markdown changes#9043
hweihwang wants to merge 1 commit into
nextcloud:mainfrom
hweihwang:review/structured-markdown-comparison-model

Conversation

@hweihwang

@hweihwang hweihwang commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

In one sentence: the semantic model that turns two Markdown documents into a typed list of what changed.

What and why

Text cannot tell you what changed between two versions of a Markdown document. Byte diffs report edits, not meaning — nothing says a paragraph was inserted, a table row changed, or a link target moved. This PR adds the model that answers that question: two documents in, a typed list of changes out.

What's in this PR

  • A comparison model built on ProseMirror ChangeSet
  • Every change classified as text, formatting, attribute, structure, or unknown
  • Conservative move detection and position mapping between the two revisions
  • An explicit complexity limit — the caller gets a "limited" result, never a silent partial list
  • No UI. This unit deliberately has no screenshot; the three views arrive in the next PRs.

Design notes

  • One shared schema is an invariant. ProseMirror compares node types by identity, so both editors must parse against the same schema instance — otherwise the result is wrong, not slow. Tests pin this.
  • Moves under-report on purpose. Only exact moves are detected; anything ambiguous becomes a remove + insert. A missed move is noise; a wrong move claims edited content is unchanged.
  • Attributes and formatting stay separate so "hide formatting-only changes" can never hide a changed link target.

Stack

First of six. #9044 builds on it, then #9045 and #9046. The Collectives side lands in nextcloud/collectives#2697 and #2698 after all four Text PRs.

Verification

ts:check and lint pass; complete suite 1,768/1,768 at this tip. Zero drift against upstream main; the sign-off rebase changed only commit metadata.

AI assistance

Commits carry Assisted-by: Codex:gpt-5.6-sol; an independent review pass was run with Claude Opus 5. This description was drafted with Hermes (deepseek-v4-pro) from my notes, then reviewed by me.

Related

Parse immutable documents, normalize their semantic structure, and emit bounded stable change descriptors. Support one shared schema for both parsed documents.

Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant