mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 09:16:02 +03:00
[GH-ISSUE #762] [new Rule] no links in headers #2377
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#2377
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aepfli on GitHub (Mar 31, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/762
Although it is possible and it gets rendered correctly, links in headings provide a terrible user experience. Within rendered Markdown it is sometimes hard to grasp if a title is now a link or not.
Therefore, I suggest a rule called
no-links-in-headings.@aepfli commented on GitHub (Mar 31, 2023):
This rule is straightforward and not auto-fixable. If this is a rule fits the default set of markdownlint, i will gladly provide a pullrequest :)
@DavidAnson commented on GitHub (Mar 31, 2023):
This makes sense to me and seems reasonable as a built-in rule. I'll warn you now there's probably more to adding a rule then you expect. :) You can look at some previous PRs for context. Some first thoughts:
@aepfli commented on GitHub (Mar 31, 2023):
I am going down the rabbit hole :D and tried to find guidance regarding this rule.
As it was hard to find something, I thought of using ChatGPT - which sounded helpful, but sadly all mentioned articles seem to be of interest but are not accessible anymore.
Whole ChatGPT dialog
So building a real rational explanation with a strong foundation will be hard. Additionally to the hard to find rational, the existing violations within the test-repos is also interesting.
Test Repos Result
I am not sure if we want to continue, with this rule, for markdownlint (as a basic rule), or if we should release this rule on its own.
sidenote
my current implementation has following test:
@DavidAnson commented on GitHub (Apr 1, 2023):
First off, thank you for doing the research here! I absolutely agree with you that links in headings feels like something that should be avoided. BUT at the same time, the results you share show that it’s pretty common in practice and very much deliberate. As you point out, it’s fully legal to do this in HTML and in Markdown and we don’t know of any cases where doing so breaks things or leads to unpredictable behavior. So without much of a reason to tell people to avoid this, I am leaning toward your idea to release this as a separate rule instead of integrating it into the library.
@aepfli commented on GitHub (Apr 3, 2023):
Perfect, I will close this issue. As always it was my pleasure :)
@DavidAnson commented on GitHub (Apr 3, 2023):
Thanks for your understanding!