Skip to content

Make paragraph wrapping idempotent for compliant prose #331

Description

@lodyai

Summary

mdtablefix --wrap rewrites already compliant prose across many files, pulling words up to fill lines even when the original text already satisfies the 80-column policy. This creates large noisy diffs that obscure substantive documentation changes.

Reproduction

Using mdtablefix 0.4.0:

mdtablefix --wrap --renumber --breaks --ellipsis --fences --in-place docs/complexity-antipatterns-and-refactoring-strategies.md docs/rstest-bdd-users-guide.md

Input excerpt from docs/complexity-antipatterns-and-refactoring-strategies.md:

The Bumpy Road antipattern, like many software antipatterns, often emerges from
development practices that prioritize short-term speed over long-term
structural integrity.[^2] Rushed development cycles, lack of clear design, or
cutting corners on maintenance can lead to the gradual accumulation of
conditional logic within a single function.[^2]

Actual output excerpt:

The Bumpy Road antipattern, like many software antipatterns, often emerges from
development practices that prioritize short-term speed over long-term structural
integrity.[^2] Rushed development cycles, lack of clear design, or cutting
corners on maintenance can lead to the gradual accumulation of conditional
logic within a single function.[^2]

Input excerpt from docs/rstest-bdd-users-guide.md:

Steps or hooks may call `rstest_bdd::skip!` to stop executing the remaining
steps. The macro records a `Skipped` outcome and short-circuits the scenario so
the generated test returns before evaluating the annotated function body.
Invoke `skip!()` with no arguments to record a skipped outcome without a
message.

Actual output excerpt:

Steps or hooks may call `rstest_bdd::skip!` to stop executing the remaining
steps. The macro records a `Skipped` outcome and short-circuits the scenario so
the generated test returns before evaluating the annotated function body. Invoke
`skip!()` with no arguments to record a skipped outcome without a message.

Expected behaviour

--wrap should be idempotent for paragraphs that already satisfy the configured width. It should fix overlong lines without greedily repacking every paragraph, or it should provide an option for conservative wrapping that avoids churn in existing documentation.

Impact

Running the Corbusier make fmt target changed 37 Markdown files with hundreds of insertions and deletions even though the requested documentation change only touched four files. That makes formatter output difficult to review and increases the risk of committing unrelated prose changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions