Skip to main content

normalize_for_diff

Function normalize_for_diff 

Source
pub fn normalize_for_diff(text: &str) -> String
Expand description

Normalize text for more readable line-level diffs.

Long lines (single paragraphs without newlines) are split at sentence boundaries so that the diff can show which sentence changed, rather than showing the entire paragraph as one changed block.

Lines shorter than the threshold are left unchanged. When no sentence boundaries are found in a long line, it falls back to word-wrapping.