[GH-ISSUE #940] MD051 - files in repo/gist #561

Closed
opened 2026-03-03 01:28:01 +03:00 by kerem · 4 comments
Owner

Originally created by @anonymous1184 on GitHub (Aug 26, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/940

The rule triggers files in the same repo/gist.

Example README.md:

image

[Self][1]

[1]: #file-readme-md
Originally created by @anonymous1184 on GitHub (Aug 26, 2023). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/940 The rule triggers files in the same repo/gist. Example `README.md`: ![image](https://github.com/DavidAnson/markdownlint/assets/53758552/b7d20f8c-3f7d-4cfb-b957-95568449dc4a) ```md [Self][1] [1]: #file-readme-md ```
kerem 2026-03-03 01:28:01 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Aug 26, 2023):

That is correct, none of the automatically generated fragments in that file match "file-readme-md".

The rule documentation explains more: https://github.com/DavidAnson/markdownlint/blob/main/doc/md051.md

If you change the top level heading to "File README MD", the warning goes away because that creates a matching fragment: https://dlaa.me/markdownlint/#%25m%23%20File%20README%20MD%0A%0A%5BSelf%5D%5B1%5D%0A%0A%5B1%5D%3A%20%23file-readme-md%0A

<!-- gh-comment-id:1694420395 --> @DavidAnson commented on GitHub (Aug 26, 2023): That is correct, none of the automatically generated fragments in that file match "file-readme-md". The rule documentation explains more: https://github.com/DavidAnson/markdownlint/blob/main/doc/md051.md If you change the top level heading to "File README MD", the warning goes away because that creates a matching fragment: https://dlaa.me/markdownlint/#%25m%23%20File%20README%20MD%0A%0A%5BSelf%5D%5B1%5D%0A%0A%5B1%5D%3A%20%23file-readme-md%0A
Author
Owner

@anonymous1184 commented on GitHub (Aug 26, 2023):

I know, but is a valid link in GitHub and other VCS sites.

Here's an example: https://gist.github.com/64fe98f2d25c8faaeea11ebae7bf1014

Perhaps a configuration to allow this kind of links?

<!-- gh-comment-id:1694422421 --> @anonymous1184 commented on GitHub (Aug 26, 2023): I know, but is a valid link in GitHub and other VCS sites. Here's an example: <https://gist.github.com/64fe98f2d25c8faaeea11ebae7bf1014> Perhaps a configuration to allow this kind of links?
Author
Owner

@DavidAnson commented on GitHub (Aug 26, 2023):

If you are saying any link fragment could potentially be valid, then you do not want any of them to trigger a warning and so you can disable rule MD051 for that file or for your project.

<!-- gh-comment-id:1694424659 --> @DavidAnson commented on GitHub (Aug 26, 2023): If you are saying any link fragment could potentially be valid, then you do not want any of them to trigger a warning and so you can disable rule MD051 for that file or for your project.
Author
Owner

@anonymous1184 commented on GitHub (Aug 26, 2023):

I was thinking more about an exception for query fragments starting in file-, as most (if not all) of the VCS sites use it.

I basically only write in MD, so the extension is a must for me... super practical and highly configurable (I have projects with tabs, 2/4 spaces for indentation, some that require HTML tags, some that don't, etc...).

If there is no way to add it, I can ignore the warnings or disable it per-file (<!-- markdownlint-disable-file MD051 -->) once I'm sure all the other links are good to go.

Thanks a lot for this useful tool and your time.

<!-- gh-comment-id:1694427813 --> @anonymous1184 commented on GitHub (Aug 26, 2023): I was thinking more about an exception for query fragments starting in `file-`, as most (if not all) of the VCS sites use it. I basically only write in MD, so the extension is a **must** for me... super practical and highly configurable (I have projects with tabs, 2/4 spaces for indentation, some that require HTML tags, some that don't, etc...). If there is no way to add it, I can ignore the warnings or disable it per-file (`<!-- markdownlint-disable-file MD051 -->`) once I'm sure all the other links are good to go. Thanks a lot for this useful tool and your time.
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#561
No description provided.