[GH-ISSUE #548] MD051 false error #2297

Closed
opened 2026-03-07 20:06:27 +03:00 by kerem · 4 comments
Owner

Originally created by @viceice on GitHub (Aug 4, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/548

Consider this:

# NuGet

...
Renovate looks up the latest version on [nuget.org](https://nuget.org) (or on [alternate feeds](#Alternate%20feeds)) to see if any upgrades are available
...

## Alternate feeds

...

That causes the following error

nuget.md:29:44 MD051/link-fragments Link fragments should be valid [Context: "[nuget.org](https://nuget.org/) (or on [alternate feeds](#Alternate%20feeds)"]

It seems the space encoding isn't accepted. Happens since markdownlint-cli2 v0.5.0


Originally created by @viceice on GitHub (Aug 4, 2022). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/548 Consider this: ```markdown # NuGet ... Renovate looks up the latest version on [nuget.org](https://nuget.org) (or on [alternate feeds](#Alternate%20feeds)) to see if any upgrades are available ... ## Alternate feeds ... ``` That causes the following error ``` nuget.md:29:44 MD051/link-fragments Link fragments should be valid [Context: "[nuget.org](https://nuget.org/) (or on [alternate feeds](#Alternate%20feeds)"] ``` It seems the space encoding isn't accepted. Happens since `markdownlint-cli2` `v0.5.0` --- - https://github.com/renovatebot/renovate/blob/e02967e3cda1f9e6c5452b032822fe532cdb5ac7/docs/usage/nuget.md#L29 - https://github.com/renovatebot/renovate/runs/7665141510?check_suite_focus=true#step:6:35 - https://github.com/renovatebot/renovate/pull/16926
kerem 2026-03-07 20:06:27 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@nschonni commented on GitHub (Aug 4, 2022):

An anchor link points to an ID, which can't contain a space https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute

<!-- gh-comment-id:1205458394 --> @nschonni commented on GitHub (Aug 4, 2022): An anchor link points to an ID, which can't contain a space https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute
Author
Owner

@viceice commented on GitHub (Aug 4, 2022):

ok, but how do we address that headline?

<!-- gh-comment-id:1205462768 --> @viceice commented on GitHub (Aug 4, 2022): ok, but how do we address that headline?
Author
Owner

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

The example above is not canonical on GitHub because GitHub represents the heading like this: #alternate-feeds. (Specifically https://github.com/renovatebot/renovate/blob/e02967e3cda1f9e6c5452b032822fe532cdb5ac7/docs/usage/nuget.md#alternate-feeds if you click on the anchor.) This linking behavior is not part of the CommonMark standard, but this rule enforces GitHub syntax and therefore the violation is intended. That said, the link you provide does work in that document and I think perhaps GitHub is handling the mismatch (can't check from my phone). But I think it is reasonable for the rule to complain here since the link does not match what the document produces.

<!-- gh-comment-id:1205476986 --> @DavidAnson commented on GitHub (Aug 4, 2022): The example above is not canonical on GitHub because GitHub represents the heading like this: #alternate-feeds. (Specifically <https://github.com/renovatebot/renovate/blob/e02967e3cda1f9e6c5452b032822fe532cdb5ac7/docs/usage/nuget.md#alternate-feeds> if you click on the anchor.) This linking behavior is not part of the CommonMark standard, but this rule enforces GitHub syntax and therefore the violation is intended. That said, the link you provide does work in that document and I think perhaps GitHub is handling the mismatch (can't check from my phone). But I think it is reasonable for the rule to complain here since the link does not match what the document produces.
Author
Owner

@DavidAnson commented on GitHub (Oct 18, 2022):

Closing in favor of #605.

<!-- gh-comment-id:1281811043 --> @DavidAnson commented on GitHub (Oct 18, 2022): Closing in favor of #605.
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#2297
No description provided.