How anglesharp/anglesharp.diffing works
Main Components
a. Core Engine Layer:
• HtmlDifferenceEngine (central component)
• DiffContext
• ComparisonSource system
• DiffResult handling
b. Strategy Layer:
• Node Strategies
• Element Strategies
• Attribute Strategies
• Text Node Strategies
• Comment Strategies
c. Diff Types Layer:
• Element Diffs
• Attribute Diffs
• Text Diffs
• Comment Diffs
┌─────────────────────────────────────────────┐
• Public API Layer │
• (HtmlDiffer, DiffBuilder) │
• ┤
• Strategy Pipeline Layer │
• (DiffingStrategyPipeline, Matchers) │
• ┤
• Core Engine Layer │
• (HtmlDifferenceEngine, DiffContext) │
• ┤
• AngleSharp Core │
• (DOM Parsing & Manipulation) │
• ┘
Key Relationships
• Input HTML → AngleSharp Core → Core Engine → Strategy Pipeline → Diff Results
Important Details
a. Strategy Pipeline:
• How different strategies are chained
• Three main strategy types:
• Filter Strategies
• Match Strategies
• Compare Strategies
b. Comparison Flow:
• Relationship between Control and Test nodes
• Where filtering, matching, and comparison happen
Specific Implementation Notes
• Use a hexagonal architecture style to show how the core engine interfaces with different strategies
• Extension points for custom strategies
• Relationship with AngleSharp's DOM implementation
Additional Elements
• Notes about the pipeline nature of the diffing process
• Extensibility points for custom strategies