Skip to content

Wrap tables without leaving MD013 line-length failures #332

Description

@lodyai

Summary

mdtablefix --wrap --renumber --breaks --ellipsis --fences --in-place rewrites Markdown tables but can leave rows far beyond the configured 80-column markdownlint limit. In some cases, the table shape changes without making the result lint-clean, so the formatter produces churn and the following markdownlint --fix still fails with MD013/line-length.

Environment

  • mdtablefix 0.4.0
  • Command run through mdformat-all:
mdtablefix --wrap --renumber --breaks --ellipsis --fences --in-place

Reproduction

In leynos/chutoro, run:

make fmt

The formatter rewrites table alignment in documents such as docs/chutoro-design.md, docs/rust-testing-with-rstest-fixtures.md, and docs/repository-layout.md, but the later markdownlint step reports remaining MD013 failures.

Examples from the run:

./docs/chutoro-design.md:1414:81 error MD013/line-length Line length [Expected: 80; Actual: 555]
./docs/rust-testing-with-rstest-fixtures.md:1347:81 error MD013/line-length Line length [Expected: 80; Actual: 125]
./docs/repository-layout.md:56:81 error MD013/line-length Line length [Expected: 80; Actual: 101]

Representative diff from docs/rust-testing-with-rstest-fixtures.md:

-| Attribute                    | Core Purpose                                                            |
-| ---------------------------- | ----------------------------------------------------------------------- |
-| #[rstest]                    | Marks a function as an rstest test; enables fixture injection and parameterization.          |
+| Attribute                  | Core Purpose                                             |
+| -------------------------- | -------------------------------------------------------- |
+| #[rstest]                  | Marks a function as an rstest test; enables fixture injection and parameterization.          |

Expected behaviour

When table wrapping is enabled, mdtablefix should either:

  • produce a table that satisfies the configured Markdown line-length policy;
  • preserve the original table when it cannot improve the result; or
  • emit a clear diagnostic that the table cannot be safely wrapped.

Actual behaviour

mdtablefix rewrites the table, leaves the rows over 80 columns, and causes the repository's make fmt target to fail once markdownlint --fix validates the output.

Impact

This creates noisy formatting churn and makes a formatter run produce a non-lint-clean working tree.

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