mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-26 01:36:03 +03:00
[GH-ISSUE #1162] MD051 support icon #2477
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#2477
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 @unional on GitHub (Mar 26, 2024).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1162
@DavidAnson commented on GitHub (Mar 26, 2024):
This rule expects the GitHub representation which is described at the bottom of the documentation and does not include emoji: https://github.com/DavidAnson/markdownlint/blob/main/doc/md051.md
If that representation is used, no warning is produced: https://dlaa.me/markdownlint/#%25m%23%20%F0%9F%94%80%20Distributive%0A%0A%5B%F0%9F%94%80%20distributive%5D(%23-distributive)%0A
The rule is operating as intended.
@unional commented on GitHub (Mar 27, 2024):
Maybe this is an issue on vscode. The
#-distributivewithout the emoji does not work.@DavidAnson commented on GitHub (Mar 27, 2024):
From what I can tell, GitHub web does not recognize the link in your example - whereas it does for the link that markdownlint accepts in my demo. In the interest of supporting a single canonical way of defining heading links which are not part of the CommonMark specification, GitHub seems to be the next-best authority on Markdown (see: GitHub Flavored Markdown). As such, I feel the current behavior of markdownlint is reasonable and I encourage you to open an issue in the VS Code repo for them to allow or convert to GitHub's approach.
@giacomorebecchi commented on GitHub (Apr 4, 2024):
Hi, I stumbled upon this issue as well. I realised that
mkdocsremoves the leading-, hence in your case the correct link would be#distributive. Do you think there is the space to add a possibility to configure the removal of leading dashes? Thanks!@DavidAnson commented on GitHub (Apr 5, 2024):
@giacomorebecchi, can you link to the documentation, specification, or implementation of that mkdocs behavior?
@giacomorebecchi commented on GitHub (Apr 5, 2024):
I couldn't find an explicit reference in the documentation, but, after a bit of deep-diving, I found out that:
tocextensiontoccalls theslugifyfunction to transform a Heading into the correct link (see here the source code)The reason is that it calls
stripbefore replacing whitespaces with-@unional commented on GitHub (Apr 5, 2024):
FYI you can see that the issue on vscode is closed: https://github.com/microsoft/vscode-markdown-languageservice/issues/171
Next version of vscode will have the fix.
vscode will be using https://github.com/Flet/github-slugger
@DavidAnson commented on GitHub (Apr 5, 2024):
Thanks! It sounds like VS Code is also standardizing on GitHub behavior. That doesn't mean markdownlint can't also allow other forms, but it makes it a bit less interesting in my mind.
@giacomorebecchi commented on GitHub (Apr 5, 2024):
@DavidAnson I understand that it looks minor to you, but do you see the opportunity to accept a contribution to make this behaviour parametrisable? It would turn out to be very useful for me! If yes, I could try to work on it (although I've never written anything in JS, but that would be a nice chance to learn). Thanks in advance!
@DavidAnson commented on GitHub (Apr 5, 2024):
@giacomorebecchi I'm not intimidated by the amount of work here. I am questioning whether it is a good change to add. So far, when dealing with syntax and behavior that is not part of the CommonMark specification, I have used the GitHub-Flavored Markdown specification and that has worked well. This behavior is not described there, but by matching GitHub, I feel this behavior is consistent with that spirit.
The kind of changes here do not seem to lend themselves to expressing abstractly with text or regular expression, so the customization mechanism may need to be implementing multiple behaviors in the rule and allowing people to choose among them. (Allowing both implementations together creates situations where mistakes are not detected.) That is additional complexity for me to deal with and it opens the door for people with other scenarios to want to add them as well. My impression (and I do not have data for this, so would welcome it!) is that GitHub and VS Code represent the vast majority of the use of heading links in practice, so the benefits of doing so are limited.
@giacomorebecchi commented on GitHub (Apr 9, 2024):
@DavidAnson I understand your point, thanks for the detailed explanation! I have no data regarding usage of GitHub and VSCode w.r.t. Mkdocs. I think I will proceed by making an alternative extension to
tocthat follows GitHub-Flavored Markdown specification. Thanks again for your work and support!