Skip to content

MD024 is unconfigured, so legitimate cross-parent duplicate headings cannot lint clean #1621

Closed

Description

@ptr727

The canonical .markdownlint-cli2.jsonc sets no MD024 key, so the rule runs at its default siblings_only: false. That default flags two headings with the same text anywhere in a file, including under different parents, which is the normal shape of a reference document organized by vendor or by device. Measured against markdownlint-cli2 0.23.2, the build bundled in the pinned markdownlint-cli2-action v24.2.0 that validate-task.yml runs.

1. The default flags a structure that is not a mistake

Two synthetic files, one duplicate heading text in each:

<!-- cross-parent.md -->
# Doc

## Vendor A

### Firmware

## Vendor B

### Firmware
<!-- same-parent.md -->
# Doc

## Vendor A

### Firmware

### Firmware
Setting cross-parent.md same-parent.md
MD024 unset (current canonical, siblings_only: false) flagged flagged
"MD024": { "siblings_only": true } clean flagged

siblings_only: true keeps the finding that is a genuine authoring mistake, two identical headings under one parent, and drops the one that is a legitimate hierarchy. The current setting cannot distinguish them, so a document with a per-vendor Firmware or Configuration subsection cannot lint clean without renaming headings to encode their parent.

2. Link resolution never depended on this rule

MD024 does not participate in anchor generation, so the flagged structure already links correctly. With the two Firmware headings in place, MD051 accepts #firmware and #firmware-1 and rejects a fragment that matches no heading:

doc.md:4:3 error MD051/link-fragments Link fragments should be valid [Context: "[b](#firmware-2)"]

So the rule reports a problem that has no rendered consequence, which is the case for relaxing it rather than working around it.

3. Every workaround available today is worse than the relaxation

  • Rename the headings to encode the parent. Works everywhere and needs no config change, at the cost of repeating the hierarchy in every duplicated subsection. This is the only workaround with no correctness risk.
  • Custom heading id, ### Firmware {#arc-firmware}. MD051 resolves a link to #arc-firmware under this syntax, so the form lints clean. GitHub Flavored Markdown has no custom-heading-id extension, so the braces are expected to render as literal heading text and the anchor to differ from the one the author wrote. Not measured against GitHub's renderer in this report, and it should be confirmed before anyone relies on it either way. If it holds, the current MD024 default actively nudges authors toward a form that passes CI and renders wrong, which is the worst available outcome.
  • Explicit anchor element, <a name="arc-firmware"></a>. Resolves under MD051, but trips MD033 against allowed_elements: ["details", "summary"]. Permitting it means adding a fleet-wide, which loosens inline-HTML policy far beyond this case and cuts against the rule's stated intent that native Markdown wins.

Proposed change

Add to the config block, in the house comment style:

// MD024 allows the same heading text under different parents, so a document
// organized by vendor or device can repeat a subsection name.
// Two identical headings under one parent still flag.
"MD024": { "siblings_only": true },

Related to #1495, which files separate measured defects in the same carried file. No overlap in the keys touched.

Activity

  1. ptr727 commented on Nov 2, 2026

    @ptr727
    OwnerAuthor

    Closed by decision triage (2026-11-02), at the maintainer's go-ahead: overtaken by #1630, which set MD024 to sibling scope in the carried markdown config. It is on main.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions