Skip to content

feat(md077): support fixed continuation indent config - #786

Merged
rvben merged 2 commits into
rvben:mainfrom
DavidPandleton:feat/md077-fixed-indent
Aug 3, 2026
Merged

feat(md077): support fixed continuation indent config#786
rvben merged 2 commits into
rvben:mainfrom
DavidPandleton:feat/md077-fixed-indent

Conversation

@DavidPandleton

Copy link
Copy Markdown
Contributor

Adds an optional indent setting to MD077 so documents that follow a different indentation convention (4 spaces for MkDocs, or a .editorconfig-driven style) can pin the required continuation indent instead of the content-column-derived default. When set, the requirement becomes marker column + indent, per item.

Closes #784.

Adds an optional `indent` setting to MD077 so documents that follow a
different indentation convention (e.g. 4 spaces for MkDocs, or a
.editorconfig-driven style) can pin the required continuation indent
instead of the content-column-derived default. The requirement becomes
marker column + configured indent, per item.

Closes #784
@rvben
rvben merged commit fea6322 into rvben:main Aug 3, 2026
14 checks passed
@rvben

rvben commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Thanks for this, and for the clean implementation. The per-item marker column + indent shape is right, and I checked it against the document in #784: with indent = 4, rumdl fmt produces exactly the 4-space form that was asked for, and a re-check is clean.

I merged this and pushed four corrections on top rather than sending you round-trips, since most of them need repo internals that are not reasonable to expect from outside:

  1. The config key validator did not know about indent. impl_rule_config_methods!(MD077Config) derives a rule's known keys by serializing the default config through JSON to TOML, which drops None fields, so an Option key is invisible to it. [MD077] indent = 4 printed Unknown option for rule MD077: indent and failed the run under --deny-config-warnings, even though the setting itself worked. The nullable arm of that macro fixes it. Worth knowing for any future Option config key.
  2. Under --flavor mkdocs, a configured indent could lower the 4-space minimum. With indent = 2, a document correctly indented at 4 was reported as over-indented and fix rewrote it to 2, which Python-Markdown no longer reads as part of the list item. That minimum is a compatibility floor rather than a style default, so a configured indent may now raise it but not lower it. It stays scoped to that flavor: under standard, indent = 2 still means 2.
  3. One message claimed a consequence that was not true. A configured indent produced "needs 4 spaces of indentation to remain part of the list" for content that was still part of the list. A requirement coming from the configured indent now says "to match the configured indent"; the structural and MkDocs wordings are unchanged.
  4. indent = 0 is now rejected. It asks for continuation at the marker's own column, which ends the list item, so correctly indented content was flagged as "over-indented (expected 0, found 2)".

I also corrected docs/md077.md, which said content below the requirement is flagged under the same rules as the default. That is not true of tight lazy continuation: style still decides which lines get checked, and indent only decides what they are checked against.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MD077] Use MkDocs indentation even in Commonmark documents

2 participants