[GH-ISSUE #1277] Link fragments shows warning MD051 when target is preceeded by emoji. #652

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

Originally created by @AxelBrinck on GitHub (Jun 28, 2024).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1277

Hi there! 👋🏻

Thanks for the work on this great repository.

Link fragments to sections works fine, until the section has an emoji 😿

The following link:

- [Username Created](#-username-created).

Redirects to the following section:

### :arrow_left: Username Created

But at the same time shows warning: MD051.

The warning disappears if the emoji and the "-" symbol prefixing the link is removed.

I read that prefixing headers with an "-" in link fragments should allow to have an emoji.

Can this be reviewed?

Thanks!

Originally created by @AxelBrinck on GitHub (Jun 28, 2024). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/1277 Hi there! 👋🏻 Thanks for the work on this great repository. Link fragments to sections works fine, until the section has an emoji :crying_cat_face: The following link: ~~~md - [Username Created](#-username-created). ~~~ Redirects to the following section: ~~~md ### :arrow_left: Username Created ~~~ But at the same time shows warning: [MD051](https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md051.md). The warning disappears if the emoji and the "-" symbol prefixing the link is removed. I read that prefixing headers with an "-" in link fragments should allow to have an emoji. Can this be reviewed? Thanks!
kerem 2026-03-03 01:28:47 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@DavidAnson commented on GitHub (Jun 28, 2024):

Per the documentation, MD051 uses the GitHub heading algorithm as the canonical form for headings:

https://github.com/DavidAnson/markdownlint/blob/main/doc/md051.md

As you can confirm via GitHub, the GitHub representation for the link you show is this:

#arrow_left-username-created

Using that in Markdown produces no violations from MD051, so I claim the rule is behaving correctly:

https://dlaa.me/markdownlint/#%25m%23%20Issue%201277%0A%0A%23%23%20%3Aarrow_left%3A%20Username%20Created%0A%0A-%20%5BUsername%20Created%5D(%23arrow_left-username-created).%0A

<!-- gh-comment-id:2197240023 --> @DavidAnson commented on GitHub (Jun 28, 2024): Per the documentation, MD051 uses the GitHub heading algorithm as the canonical form for headings: https://github.com/DavidAnson/markdownlint/blob/main/doc/md051.md As you can confirm via GitHub, the GitHub representation for the link you show is this: `#arrow_left-username-created` Using that in Markdown produces no violations from MD051, so I claim the rule is behaving correctly: https://dlaa.me/markdownlint/#%25m%23%20Issue%201277%0A%0A%23%23%20%3Aarrow_left%3A%20Username%20Created%0A%0A-%20%5BUsername%20Created%5D(%23arrow_left-username-created).%0A
Author
Owner

@AxelBrinck commented on GitHub (Jun 28, 2024):

Ah, yes, this works! Thanks a lot for helping! 😸

<!-- gh-comment-id:2197463085 --> @AxelBrinck commented on GitHub (Jun 28, 2024): Ah, yes, this works! Thanks a lot for helping! 😸
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#652
No description provided.