Skip to content

[pull] main from Milkdown:main#190

Merged
pull[bot] merged 2 commits into
code:mainfrom
Milkdown:main
Apr 11, 2026
Merged

[pull] main from Milkdown:main#190
pull[bot] merged 2 commits into
code:mainfrom
Milkdown:main

Conversation

@pull

@pull pull Bot commented Apr 11, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

* feat: per-block diff via LCS matching

Replace the single-ReplaceStep diff with an LCS-based per-block matcher
that recurses into container nodes (bullet_list, blockquote, table...).
Unrelated edits in adjacent blocks no longer collapse into one big merged
change, so the review UI can surface them as independent accept/reject
units.

Along the way, fix a few rendering bugs in the components package that
this exposed:

- hasBlockContent wrongly flagged attribute-only edits on list_item and
  other container open-tokens as block content, wrapping the enclosing
  list/blockquote in a removed-block decoration.
- mergeBlockChanges expanded pure inserts/deletes sitting at a custom
  block boundary into the neighbouring block, double-rendering tables
  and requiring repeated accept clicks to clear a single change.
- Inserts at the doc end anchored after the trailing empty paragraph
  Crepe keeps as a placeholder, pushing it out of its trailing slot and
  leaving an orphaned block-deletion widget on the next recompute.

* refactor: address review feedback on per-block diff

- Type the token encoder as TokenEncoder<string | number> to drop the
  `as unknown as null` casts and let the encoder methods return their
  actual values.
- Replace the large-container fallback's self-wrapping (parent.copy of
  the container inside itself) with a direct ChangeSet over the
  container's content, translated by contentStart. Avoids the off-by-one
  abs translation and the structurally odd parent === node wrapper.
- Coalesce with every already-emitted custom-block entry that overlaps,
  not just the first one, so the merged output never contains
  overlapping duplicate custom-block ranges.

* refactor: address second round of review feedback

- Clarify the computeDocDiff docstring: a range that happens to cover
  the full doc still uses the per-block path; only a sub-region range
  takes the legacy single-step fallback.
- Avoid wasted signature computation for large containers. diffChildrenLcs
  now takes raw nodes and checks childCount against LCS_MAX_CHILDREN
  before building ParentPair / signatures, so the fallback path no
  longer walks the whole subtree to compute tokens it immediately
  throws away.
- Rename the misleading "blockquote text edit" test to accurately
  reflect that it exercises nested ul/li/p recursion.
@pull pull Bot locked and limited conversation to collaborators Apr 11, 2026
@pull pull Bot added the ⤵️ pull label Apr 11, 2026
* chore: bump up pnpm/action-setup action to v6

* [autofix.ci] apply automated fixes

* chore: f

* [autofix.ci] apply automated fixes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Saul-Mirone <Saul-Mirone@outlook.com>
@pull pull Bot merged commit 13bf095 into code:main Apr 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant