Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip invisible characters from anchors #351

Open
flanakin opened this issue Oct 21, 2023 · 2 comments
Open

Strip invisible characters from anchors #351

flanakin opened this issue Oct 21, 2023 · 2 comments

Comments

@flanakin
Copy link

flanakin commented Oct 21, 2023

Proposal

When you create a header markdown header, an anchor is created for you and special characters are removed and spaces are trimmed. This works great... mostly. There are 2 issues:

  1. When an emoji is used, there are sometimes invisible characters left behind.
  2. When there's a space before or after the emoji, the space isn't getting trimmed.

Proposal

Remove special and invisible characters first, then trim spaces.

Example

## 🙋‍♀️ Ask a question

To the naked eye, this looks like #-ask-a-question, which is mostly fine barring the extra space. But when you see this in the browser, it's rendered as #%EF%B8%8F-ask-a-question.

This should render as #ask-a-question without the invisible characters or extra space.

@waldyrious
Copy link

Remove special and invisible characters first

I think replacing such characters with hyphens might be more predictable / less surprising. So #-ask-a-question is the result I feel would be most intuitive. (That said, I agree that removing them altogether is an improvement over the current situation.)

@wooorm
Copy link

wooorm commented Oct 22, 2023

(I don’t work at GH)

  • they don’t do slugs in this project
  • changing this will break existing things, I don’t think it’s likely to happen, also because they almost never change things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants