[GH-ISSUE #544] MD053 problem with link definition usage over two lines in blockquotes #443

Closed
opened 2026-03-03 01:26:58 +03:00 by kerem · 2 comments
Owner

Originally created by @ericcornelissen on GitHub (Aug 1, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/544

Rule MD053 incorrectly complains about an unused link definition when the link usage:

  1. Spans 2 lines
  2. Is in a blockquote

Reproducing

The following MarkDown file should reproduce the error:

<!-- error.md -->

# Example Blockquotes

Example 1: newline in link, working

> Find out more in the GitHub Actions documentation on [`push` events], [branch
> and tag filters], and [path filters].

Example 2: newline in link, not working

> Find out more in the GitHub Actions documentation on [`repository_dispatch`
> events] and [`workflow_dispatch` events].

[`pull_request` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request
[`push` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push
[`repository_dispatch` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
[`workflow_dispatch` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
[branch and tag filters]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
[path filters]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths

Result:

$ npx markdownlint error.md
error.md:20:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "`repository_dispatch` events"] [Context: "[`repository_dispatch` events]..."]
When removing the blockquotes, the problem is no longer reporter.
<!-- success.md -->

# Example No Blockquotes

Example 1: newline in link, working

Find out more in the GitHub Actions documentation on [`push` events], [branch
and tag filters], and [path filters].

Example 2: newline in link, not working

Find out more in the GitHub Actions documentation on [`repository_dispatch`
events] and [`workflow_dispatch` events].

[`pull_request` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request
[`push` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push
[`repository_dispatch` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch
[`workflow_dispatch` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
[branch and tag filters]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags
[path filters]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths

Result:

$ npx markdownlint success.md

(These examples are based on the documentation for ericcornelissen/svgo-action, where I first encountered this bug.)

Originally created by @ericcornelissen on GitHub (Aug 1, 2022). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/544 Rule [MD053](https://github.com/DavidAnson/markdownlint/blob/cba2ca0dbdc8f11e4b97c054380ffd52bb7aae19/doc/Rules.md#md053---link-and-image-reference-definitions-should-be-needed) incorrectly complains about an unused link definition when the link usage: 1. Spans 2 lines 2. Is in a blockquote ## Reproducing The following MarkDown file should reproduce the error: ```markdown <!-- error.md --> # Example Blockquotes Example 1: newline in link, working > Find out more in the GitHub Actions documentation on [`push` events], [branch > and tag filters], and [path filters]. Example 2: newline in link, not working > Find out more in the GitHub Actions documentation on [`repository_dispatch` > events] and [`workflow_dispatch` events]. [`pull_request` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request [`push` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push [`repository_dispatch` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch [`workflow_dispatch` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch [branch and tag filters]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags [path filters]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths ``` Result: ```sh $ npx markdownlint error.md error.md:20:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "`repository_dispatch` events"] [Context: "[`repository_dispatch` events]..."] ``` <details> <summary>When removing the blockquotes, the problem is no longer reporter.</summary> ```markdown <!-- success.md --> # Example No Blockquotes Example 1: newline in link, working Find out more in the GitHub Actions documentation on [`push` events], [branch and tag filters], and [path filters]. Example 2: newline in link, not working Find out more in the GitHub Actions documentation on [`repository_dispatch` events] and [`workflow_dispatch` events]. [`pull_request` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request [`push` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push [`repository_dispatch` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#repository_dispatch [`workflow_dispatch` events]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch [branch and tag filters]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestbranchestags [path filters]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onpushpull_requestpaths ``` Result: ```sh $ npx markdownlint success.md ``` </details> _(These examples are based on the documentation for [ericcornelissen/svgo-action](https://github.com/ericcornelissen/svgo-action), where I first encountered this bug.)_
kerem 2026-03-03 01:26:58 +03:00
Author
Owner

@DavidAnson commented on GitHub (Aug 1, 2022):

The problem is when the shortcut link spans multiple lines in a block quote. Your example 2 doesn't seem to demonstrate that because it uses the same link from example 1. Removing example 1 generates a failure.

<!-- gh-comment-id:1201663720 --> @DavidAnson commented on GitHub (Aug 1, 2022): The problem is when the shortcut link spans multiple lines in a block quote. Your example 2 doesn't _seem_ to demonstrate that because it uses the same link from example 1. Removing example 1 generates a failure.
Author
Owner

@ericcornelissen commented on GitHub (Aug 1, 2022):

My bad 😅 Thanks for double checking it! I updated the original issue description to avoid confusion.

<!-- gh-comment-id:1201676545 --> @ericcornelissen commented on GitHub (Aug 1, 2022): My bad :sweat_smile: Thanks for double checking it! I updated the original issue description to avoid confusion.
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#443
No description provided.