Conversation
…andling Add optional logging infrastructure to the document comparison engine that: - Captures warnings about document issues without failing the comparison - Handles orphaned footnote/endnote references gracefully when logging is enabled - Provides detailed log entries with codes, messages, and document locations New classes: - ComparisonLog: Collects log entries during comparison - ComparisonLogEntry: Individual entry with level, code, message, details, location - ComparisonLogCodes: Well-known codes like ORPHANED_FOOTNOTE_REFERENCE API changes: - WmlComparerSettings.Log: Optional log collector (null = throw on errors, set = log and continue) - CompareDocumentsWithLog: Returns document + log in JSON response - CompareDocumentsToHtmlWithLog: Returns HTML + log in JSON response TypeScript bindings: - ComparisonLogEntry, CompareResultWithLog, CompareToHtmlResultWithLog types - ComparisonLogLevel enum and ComparisonLogCodes constants - compareDocumentsWithLog() and compareDocumentsToHtmlWithLog() functions Also fixes CompareDocumentsToHtmlFull to properly pass detailThreshold and caseInsensitive options (previously only used in DOCX output).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Background
Some documents have structural issues (e.g., footnote references pointing to non-existent footnote definitions) that previously caused the comparison to fail with "Invalid document" exceptions. This PR allows users to opt-in to logging mode where these issues are captured and reported while the comparison continues.
Changes
New files:
Docxodus/ComparisonLog.cs- Core logging infrastructure classesModified files:
Docxodus/WmlComparer.cs- AddedLogproperty to settings, updated methods to log warnings instead of throwingwasm/DocxodusWasm/DocumentComparer.cs- AddedCompareDocumentsWithLogandCompareDocumentsToHtmlWithLogmethodswasm/DocxodusWasm/JsonContext.cs- Added DTOs for log entries and responsesnpm/src/types.ts- Added TypeScript types for log entries and responsesnpm/src/index.ts- Added wrapper functions for log-enabled comparisonAPI
C# (.NET):
TypeScript/JavaScript:
Test plan