Skip to main content

Module normalize

Module normalize 

Source
Expand description

Minimal text-shape normalization: line-ending detection / round-trip and BOM stripping. The patcher uses these to canonicalize text to LF before applying edits and to restore the original shape on write-back.

Ported from omp packages/hashline/src/normalize.ts.

Structs§

BomResult
BOM strip result.

Enums§

LineEnding
Line ending style.

Functions§

detect_line_ending
Detect the first line ending style in content. Defaults to LF when neither is present.
normalize_to_lf
Normalize every line ending to LF.
restore_line_endings
Re-encode LF text with the requested line ending.
strip_bom
Strip a UTF-8 BOM if present.