Skip to content

MD053 problem with link definition usage over two lines in blockquotes #544

@ericcornelissen

Description

@ericcornelissen

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.)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions