npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-docx-diff

v0.4.3

Published

n8n community node pack: DOCX tracked changes tools (native + redlines)

Readme

n8n-nodes-docx-diff

Generate a DOCX with tracked changes (w:ins/w:del) from two DOCX inputs so Google Docs shows Suggestions and Microsoft Word shows tracked changes.

What it does

  • Produces a DOCX that preserves the revised document structure (styles, numbering, rels, images)
  • Highlights differences at paragraph/run level
  • Handles: body paragraphs, lists/numbering, tables, text boxes, SDT (content controls), hyperlinks
  • Omits bookmarks (to avoid distractions in Google Docs)
  • Optional headers/footers diffing is implemented internally and can be enabled

Input/Output

  • Inputs: two incoming items to the node (Original on input 1, Revised on input 2), each with one DOCX binary. If multiple binaries exist, the node picks by DOCX MIME type or .docx filename, otherwise errors with choices.
  • Output: a single item containing binary diff.docx and a warnings array in json.

Key behaviors

  • Lists: pPr/numPr are preserved; insertions wrap only textual runs; deletions synthesize a paragraph with original pPr and deleted runs; modifications wrap changed run spans
  • Tables, text boxes, SDT: paragraphs inside are diffed with the same engine
  • Hyperlinks preserved; bookmarks omitted
  • Existing tracked revisions: existing ins/del/move* are stripped during comparison (ignore). A strict mode exists internally to fail if present

Recent improvements

  • Style/List-aware alignment keys to reduce cross-style mismatches and align bullets at the correct levels
  • Fallback alignment mode (text-only keys) to avoid pathological non-matching
  • Similarity heuristic to choose paragraph-level vs inline run-level diffs
  • Punctuation-aware tiny-gap merging to avoid noisy equal islands
  • Strict same-level bullet pairing (requires same ilvl; if numId differs, require higher similarity)
  • Numbering-only change suppression (when text is equal but numbering changes)
  • Stable timestamp mode for byte-identical outputs across runs in CI

Options (defaults shown)

  • granularity: 'word' | 'char' (default: 'word')
  • listIdAlignmentMode: 'ignore-numId' | 'exact' (UI stub)
  • styleChangeEditMode: 'paragraph' | 'inline' (UI stub)
  • suppressWhitespaceOnly: boolean (default: true)
  • includeLists/includeTables/includeTextBoxes/includeHeadersFooters: boolean (defaults: lists/tables/textboxes true; headers/footers false)
  • existingTrackedRevisions: 'ignore' | 'fail' (default: 'ignore')
  • limits: { maxTotalUnzippedBytes, maxEntries, maxEntrySize, maxTokensPerParagraph }
  • mergeSmallEqualGapsThreshold: number (default: 1)
  • mergeSmallPunctGapsThreshold: number (default: 1)
  • punctuationClass: string (default: ",.;:!?")
  • unicodeNormalization: 'off' | 'NFC' | 'NFKC' (default: 'NFC')
  • collapseNBSP: boolean (default: true)
  • normalizeQuotes: boolean (default: true)
  • paragraphAligner: 'lcs' | 'hybrid' (default: 'hybrid')
  • listAwareAlignment: boolean (default: true)
  • styleAwareAlignment: boolean (default: true)
  • modifiedParagraphSimilarityThreshold: number (default: 0.3)
  • timestampMode: 'now' | 'fixed' (default: 'now')
  • fixedTimestamp: ISO string used when timestampMode is 'fixed' (default: '2000-01-01T00:00:00.000Z' if not supplied)

NormalizationProfile

  • Shared with HTML→DOCX node for consistent normalization used in matching/alignment only.
  • Defaults:
{
  "punctuation": "conservative",
  "whitespacePolicy": "collapse",
  "collapseNBSP": true,
  "normalizeQuotes": true,
  "unicodeNormalization": "NFC"
}

Minimal DOCX constraints

  • Pre/post-diff passes aim to keep only w:b/w:i runs and w:pStyle/w:numPr paragraph properties; remove bookmarks; collapse empties. List and hyperlink wrappers are preserved.

Usage (self-hosted n8n)

  • Install this Community Node package and use the node "DOCX Track-Diff"
  • Connect two upstream nodes producing DOCX binaries to the two inputs
  • Execute the workflow; the resulting diff.docx binary shows Suggestions in Google Docs and tracked changes in Word

Development

  • Node 20+
  • Install: npm ci
  • Lint: npm run lint
  • Build: npm run build
  • Test: npm test

License

  • MIT