Expand description
Block alignment and character-level diff used by miwa site --diff.
Structs§
- Block
Key - A block with its comparison key and similarity text.
- Row
- One aligned row; indices point into the left / right block sequences.
Enums§
- Block
Kind - Kind of a rendered block.
- Op
- One edit-script operation over index ranges.
- RowKind
- Row classification in the side-by-side view.
Constants§
- ABSORB_
EQUAL_ MAX - Maximum number of equal blocks absorbed between changes.
- CHAR_
DIFF_ MAX_ CHARS - Maximum combined chars for a character-level diff of a block pair.
- DOC_
MAX_ BLOCKS - Maximum number of blocks per document before falling back.
- MYERS_
MAX_ EDITS - Maximum edit distance accepted by Myers diff.
- PAIRING_
MAX_ PRODUCT - Maximum product of deleted and added block counts for pairing.
- SIMILARITY_
THRESHOLD - Minimum similarity for pairing a deleted block with an added block.
Functions§
- align_
blocks - Aligns two block sequences per FR-117 (limits included).
- char_
marks - Character-level marks per FR-117:
Some((changed_in_a, changed_in_b))with one bool per char, or None when the pair exceeds CHAR_DIFF_MAX_CHARS or MYERS_MAX_EDITS (whole block changed, no highlight). - diff_
ops - Myers diff. Returns None when the edit distance exceeds
max_edits. - similarity
- Multiset character overlap: 2 * common / (len_a + len_b). Both empty -> 1.0.