Skip to content

feat(markdown): add isMarkdownAstEqual - #668

Merged
ocavue merged 3 commits into
masterfrom
feat/ast-equal
Oct 4, 2026
Merged

ocavue merged 3 commits into
masterfrom
feat/ast-equal

Conversation

@ocavuebot

@ocavuebot ocavuebot commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds isMarkdownAstEqual(a, b), which walks two Markdown AST trees breadth-first and compares each pair of nodes field by field. It does not compare position.

A host that compares two trees with JSON.stringify depends on the order in which fields were set, and it must strip every position first.

Summary by CodeRabbit

  • New Features

    • Added isMarkdownAstEqual to compare Markdown ASTs while ignoring position information. Optional fields that are missing or set to undefined are treated as equal.
    • Documented the comparison behavior.
  • Tests

    • Added coverage for matching and differing trees, including node fields, children, frontmatter, and serialized documents.

@vercel

vercel Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
meowdown Ignored Ignored Oct 4, 2026 8:33am UTC

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 204caed5-89f1-4fb1-a0c6-ae1ef3e8e38a
📥 Commits

Reviewing files that changed from the base of the PR and between 7eb8d75 and 067d7ee.

📒 Files selected for processing (5)
  • .changeset/markdown-ast-equal.md
  • packages/markdown/README.md
  • packages/markdown/src/ast/equal.test.ts
  • packages/markdown/src/ast/equal.ts
  • packages/markdown/src/index.ts
 ___________________________________________________
< Stack Overflow called, they want their code back. >
 ---------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

@pkg-pr-new

pkg-pr-new Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@meowdown/core@668
npm i https://pkg.pr.new/@meowdown/embed@668
npm i https://pkg.pr.new/@meowdown/markdown@668
npm i https://pkg.pr.new/@meowdown/react@668

commit: 067d7ee

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 94.52% 5785 / 6120
🔵 Statements 92.33% 6539 / 7082
🔵 Functions 92.56% 1420 / 1534
🔵 Branches 88.7% 4498 / 5071
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/markdown/src/index.ts 0% 0% 0% 0%
packages/markdown/src/ast/equal.ts 92.1% 84.84% 85.71% 90.32% 35-39, 93
Generated in workflow #2645 for commit 067d7ee by the Vitest Coverage Report Action

@ocavue
ocavue marked this pull request as ready for review October 4, 2026 08:31
@ocavue
ocavue self-requested a review as a code owner October 4, 2026 08:31
@ocavue
ocavue enabled auto-merge (squash) October 4, 2026 08:34
@ocavue
ocavue merged commit 1202aa5 into master Oct 4, 2026
12 of 13 checks passed
@ocavue
ocavue deleted the feat/ast-equal branch October 4, 2026 08:41
@ocavuebot ocavuebot mentioned this pull request Oct 4, 2026
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.

2 participants