[GH-ISSUE #958] [Duplicate] Section title with links leads to MD051 #2418

Closed
opened 2026-03-07 20:07:35 +03:00 by kerem · 2 comments
Owner

Originally created by @svg153 on GitHub (Sep 7, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/958

Problem Description

What is actually happening

With new markdownlint v0.30.0 the MD051 rule fails when you have a link to title with link.

What is the expected behavior

Define if "it is valid" to have a title with link or not. If yes, not failed, if not, and add a unit test to check this behavior. In both cases, document this case.

Context

Could be related to https://github.com/DavidAnson/markdownlint/issues/954#issuecomment-1707634031?

$ pre-commit run --all-files
...
markdownlint.............................................................Failed
- hook id: markdownlint
- exit code: 1

apps/README.md:5:1 MD051/link-fragments Link fragments should be valid [Context: "[TEST link to a](#a)"]
apps/README.md:6:1 MD051/link-fragments Link fragments should be valid [Context: "[TEST link to b](#app-b)"]
apps/README.md:10:1 MD051/link-fragments Link fragments should be valid [Context: "[TEST link to a](#a)"]
apps/README.md:11:1 MD051/link-fragments Link fragments should be valid [Context: "[TEST link to b](#app-b)"]
...

.pre-commit-config.yaml

  - repo: https://github.com/igorshubovych/markdownlint-cli.git
    rev: v0.36.0
    hooks:
      - id: markdownlint
        args: [ "--fix", "--config", ".markdownlint.json" ]

The new v0.36.0 of igorshubovych/markdownlint-cli use the new version of DavidAnson/markdownlint

.markdownlint.json

{
    "default": true,
    "ul-indent": {
        "indent": 4
    },
    "line-length": {
        "line_length": 80,
        "code_blocks": false,
        "headers": false,
        "tables": false
    },
    "no-inline-html": {
        "allowed_elements": [ "br" ]
    },
    "no-duplicate-heading": {
        "allow_different_nesting": true
    }
} 

apps/README.md

# Apps

## [a](./b)

[TEST link to a](#a)
[TEST link to b](#app-b)

## App [b](./b)

[TEST link to a](#a)
[TEST link to b](#app-b)

## test

[TEST](#test)
Originally created by @svg153 on GitHub (Sep 7, 2023). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/958 # Problem Description ## What is actually happening With new [markdownlint v0.30.0][markdownlint-0.30.0] the `MD051` rule fails when you have a link to title with link. ## What is the expected behavior Define if "it is valid" to have a title with link or not. If yes, not failed, if not, and add a unit test to check this behavior. In both cases, document this case. ## Context Could be related to https://github.com/DavidAnson/markdownlint/issues/954#issuecomment-1707634031? ``` $ pre-commit run --all-files ... markdownlint.............................................................Failed - hook id: markdownlint - exit code: 1 apps/README.md:5:1 MD051/link-fragments Link fragments should be valid [Context: "[TEST link to a](#a)"] apps/README.md:6:1 MD051/link-fragments Link fragments should be valid [Context: "[TEST link to b](#app-b)"] apps/README.md:10:1 MD051/link-fragments Link fragments should be valid [Context: "[TEST link to a](#a)"] apps/README.md:11:1 MD051/link-fragments Link fragments should be valid [Context: "[TEST link to b](#app-b)"] ... ``` `.pre-commit-config.yaml` ``` - repo: https://github.com/igorshubovych/markdownlint-cli.git rev: v0.36.0 hooks: - id: markdownlint args: [ "--fix", "--config", ".markdownlint.json" ] ``` The new [v0.36.0 of igorshubovych/markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli/releases/tag/v0.36.0) use the new version of [DavidAnson/markdownlint](https://github.com/igorshubovych/markdownlint-cli/commit/5b45a209dab7eabbfa31a319f2f9b9219d716062) `.markdownlint.json` ``` { "default": true, "ul-indent": { "indent": 4 }, "line-length": { "line_length": 80, "code_blocks": false, "headers": false, "tables": false }, "no-inline-html": { "allowed_elements": [ "br" ] }, "no-duplicate-heading": { "allow_different_nesting": true } } ``` `apps/README.md` ``` # Apps ## [a](./b) [TEST link to a](#a) [TEST link to b](#app-b) ## App [b](./b) [TEST link to a](#a) [TEST link to b](#app-b) ## test [TEST](#test) ``` [markdownlint-0.30.0]: https://github.com/DavidAnson/markdownlint/releases/tag/v0.30.0
kerem closed this issue 2026-03-07 20:07:35 +03:00
Author
Owner

@DavidAnson commented on GitHub (Sep 7, 2023):

Looks like a duplicate of #945 which is already fixed for the next release.

<!-- gh-comment-id:1710411246 --> @DavidAnson commented on GitHub (Sep 7, 2023): Looks like a duplicate of #945 which is already fixed for the next release.
Author
Owner

@svg153 commented on GitHub (Sep 7, 2023):

Looks like a duplicate of #945 which is already fixed for the next release.

OK thanks. I looked to see if it was already open or fixed, but I didn't find that issue... Sorry.

<!-- gh-comment-id:1710690076 --> @svg153 commented on GitHub (Sep 7, 2023): > Looks like a duplicate of #945 which is already fixed for the next release. OK thanks. I looked to see if it was already open or fixed, but I didn't find that issue... Sorry.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2418
No description provided.