[GH-ISSUE #1619] MD052 Breaks with Hugo inline parameters in the URLs #2571

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

Originally created by @ivanvc on GitHub (May 30, 2025).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1619

What did you do?

I have the following markdown file (test.md):

# Test

Test [link to somewhere][].

[link to somewhere]: /docs/{{<param version >}}/test

What did you expect to happen?

Running markdownlint-cli2 should not raise an MD052 issue.

What actually happened

It fails to run:

$ docker run -w /src -v $PWD:/src --rm -ti davidanson/markdownlint-cli2 test.md
markdownlint-cli2 v0.18.1 (markdownlint v0.38.0)
Finding: test.md
Linting: 1 file(s)
Summary: 2 error(s)
test.md:3:6 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "link to somewhere"] [Context: "[link to somewhere][]"]
test.md:5:30 MD033/no-inline-html Inline HTML [Element: param]

What messages or errors were there?

test.md:3:6 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "link to somewhere"] [Context: "[link to somewhere][]"]

How can the issue be reproduced?

Use the reference markdown file, and run docker run -w /src -v $PWD:/src --rm -ti davidanson/markdownlint-cli2 test.md

What version were you using?

markdownlint-cli2 v0.18.1 (markdownlint v0.38.0)

What operating system were you using?

Reproducible with Docker, the host machine is running Linux.

Originally created by @ivanvc on GitHub (May 30, 2025). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1619 <!-- Thank you for taking the time to report an issue! When deciding where to open an issue, please note there are multiple projects under the markdownlint umbrella: - https://github.com/DavidAnson/markdownlint : This is the core JavaScript/Node.js library and is used by other tools. Most issues with implementation and rule behavior belong here. - https://github.com/igorshubovych/markdownlint-cli : This is the original CLI for markdownlint. Issues specific to CLI belong here. - https://github.com/DavidAnson/markdownlint-cli2 : This is a newer CLI for markdownlint and is used by other tools. Issues specific to CLI2 belong here. - https://github.com/DavidAnson/vscode-markdownlint : This is the Visual Studio Code extension for markdownlint. Issues specific to VS Code belong here. - https://github.com/DavidAnson/markdownlint-cli2-action : This is a GitHub Action for markdownlint. Issues specific to the Action belong here. - https://github.com/markdownlint/markdownlint : This is the original markdownlint implementation for Ruby. All Ruby-related issues belong here. Before creating an issue, it's a good practice to search existing issues for something similar. If your issue has already been reported, please update the existing one with any new information. It's also good to review the documentation for any relevant details. When describing an issue, the following information is helpful: - What did you do? - What did you expect to happen? - What actually happened? - What messages or errors were there? - How can the issue be reproduced? - What version were you using? - What operating system were you using? The simplest demonstration of a problem is the most helpful. Small examples can be pasted into the issue description. (Be sure to paste as code so GitHub doesn't render the example in Markdown.) For larger examples, linking to a repository or file is more appropriate. Before proposing a new rule, please review the existing suggestions: https://github.com/DavidAnson/markdownlint/issues?q=is%3Aissue+is%3Aopen+label%3A%22new+rule%22 Thank you! --> ## What did you do? I have the following markdown file (`test.md`): ```markdown # Test Test [link to somewhere][]. [link to somewhere]: /docs/{{<param version >}}/test ``` ## What did you expect to happen? Running `markdownlint-cli2` should not raise an MD052 issue. ## What actually happened It fails to run: ``` $ docker run -w /src -v $PWD:/src --rm -ti davidanson/markdownlint-cli2 test.md markdownlint-cli2 v0.18.1 (markdownlint v0.38.0) Finding: test.md Linting: 1 file(s) Summary: 2 error(s) test.md:3:6 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "link to somewhere"] [Context: "[link to somewhere][]"] test.md:5:30 MD033/no-inline-html Inline HTML [Element: param] ``` ## What messages or errors were there? ``` test.md:3:6 MD052/reference-links-images Reference links and images should use a label that is defined [Missing link or image reference definition: "link to somewhere"] [Context: "[link to somewhere][]"] ``` ## How can the issue be reproduced? Use the reference markdown file, and run `docker run -w /src -v $PWD:/src --rm -ti davidanson/markdownlint-cli2 test.md` ## What version were you using? ``` markdownlint-cli2 v0.18.1 (markdownlint v0.38.0) ``` ## What operating system were you using? Reproducible with Docker, the host machine is running Linux.
kerem 2026-03-07 20:08:59 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (May 31, 2025):

As written, that is not a valid CommonMark link definition, so it is not recognized as such by the parser and the warning is correct. If you are able to remove the two space characters within, I believe you will get the results you'd like.

https://spec.commonmark.org/0.31.2/#link-destination

<!-- gh-comment-id:2923864192 --> @DavidAnson commented on GitHub (May 31, 2025): As written, that is not a valid CommonMark link definition, so it is not recognized as such by the parser and the warning is correct. If you are able to remove the two space characters within, I believe you will get the results you'd like. https://spec.commonmark.org/0.31.2/#link-destination
Author
Owner

@ivanvc commented on GitHub (Jun 5, 2025):

Thanks for the answer, @DavidAnson. I took a look and found that because we're using Docsy (which utilizes Hugo inline shortcodes) to generate the links, the URLs don't adhere to the CommonMark standard.

Closing.

<!-- gh-comment-id:2946861658 --> @ivanvc commented on GitHub (Jun 5, 2025): Thanks for the answer, @DavidAnson. I took a look and found that because we're using Docsy (which utilizes [Hugo inline shortcodes](https://gohugo.io/content-management/shortcodes/#inline)) to generate the links, the URLs don't adhere to the CommonMark standard. Closing.
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#2571
No description provided.