Skip to content

Scope MD007 to samples/ instead of individual files - #30

Merged
sehkone merged 1 commit into
mainfrom
sehkone/issue-26
Aug 8, 2026
Merged

Scope MD007 to samples/ instead of individual files#30
sehkone merged 1 commit into
mainfrom
sehkone/issue-26

Conversation

@sehkone

@sehkone sehkone commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Closes #26.

MD007: {indent: 4} moves from per-file markdownlint-configure-file comments to a directory config at samples/.markdownlint-cli2.yaml.

The rule is not a property of the sample documents. Python-Markdown uses tab_length = 4, so a sublist indented by 2 spaces renders as a sibling rather than a child — every file published through MkDocs is subject to it. Keeping it in per-file comments meant a new sample file would silently lose it, and coverage was already incomplete: the rule sat on the two manual samples only, because that is where violations existed when it was relocated in e64fdc3. The api-reference samples run through the same renderer and would have mis-rendered a three-level list without warning.

MD046 and MD033 stay as per-file comments — pymdownx content tabs and the API-reference badge spans really are specific to the documents that use them.

Verification

Each acceptance criterion was checked with a throwaway fixture, removed afterwards. Final tree lints clean (Summary: 0 issues in 0 files).

Check Fixture Result
New file under samples/ is protected without a comment samples/_tmp-nest.md, 2-space three-level list MD007 fires — this is what the per-file approach could not do
MD007 now covers api-reference too same list under samples/api-reference/docs/en/ MD007 fires; it would not have before
MD007 does not leak outside samples/ same list at the repository root no finding
Root MD024: siblings_only still applies under samples/ duplicate ### Detail under two different ## parents no finding, so the root config is merged rather than replaced — the default would have flagged it

No sample content changed. The only edit to the two manual files is the comment line.

MD007 is not a property of the two sample files that carried it. It
follows from the renderer: Python-Markdown uses tab_length = 4, so a
sublist indented by 2 spaces renders as a sibling rather than a child.
Every file under samples/ is published through MkDocs, so the rule
belongs to the directory.

Holding it in per-file comments left two gaps. A sample file added
later gets no MD007 unless someone remembers the comment, and coverage
was already incomplete — the rule sat on the two manual samples only,
because that is where violations existed when it was relocated. The
api-reference samples run through the same Python-Markdown and would
have mis-rendered a three-level list silently.

MD046 and MD033 stay as per-file comments. Content tabs and the badge
spans really are specific to the documents that use them.

The root config is untouched; markdownlint-cli2 merges the directory
config with it, so the MD024 baseline still applies under samples/.

Closes #26
@sehkone
sehkone merged commit 92e9344 into main Aug 8, 2026
6 checks passed
@sehkone
sehkone deleted the sehkone/issue-26 branch August 8, 2026 00:18
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.

Scope MD007 to the samples directory instead of individual files

1 participant