Expand description
Canonical formatting of a module’s Import statements — the pit-of-success
default so import blocks never need manual bikeshedding.
This is a separate pass from source_format, applied
by largo fmt, so the formatter’s token-stream invariant is untouched:
reordering imports is semantics-preserving (import order never matters), but it
does change the token stream, so it can’t live inside format_source.
Only explicit Import … statement lines in the abstract are touched (literate
[Alias](uri) links are left as the author wrote them). The block is sorted,
de-duplicated, and collapsed to the position of the first import.
Functions§
- normalize_
imports - Rewrite the entry’s abstract
Importstatements into a single canonical block: sorted, de-duplicated, placed where the first import was, with the rest removed. Prose and code are untouched. Idempotent.