markdownlint
markdownlint copied to clipboard
MD051 false error
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
- 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
An anchor link points to an ID, which can't contain a space https://html.spec.whatwg.org/multipage/dom.html#the-id-attribute
ok, but how do we address that headline?
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.
Closing in favor of #605.