-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Emoji in header breaks generated link #36
Comments
OK thanks for that info, so what we'd need to do is replace any emoj with a dash as well. You can test things by forking and modifying this repo. Finally you can PR with your changes. I'd greatly appreciate it. |
I don't think it becomes a space. It kind of just disappears. The dash is there because I had a space in between the emoji and the word. For example, this:
Would become:
|
So we need to:
|
Sounds good .. basically just add tests that assume it's doing all that and then make'em pass. Quite easy really :P main challenge how do you regex match emojis |
Apparently, detecting emojis with regex is actually really hard. Maybe this package can help: https://github.com/mathiasbynens/emoji-regex |
There seem to be some emojis that are not completely captured by this solution Didn't get around to analyze what makes this one special. Possibly related to the issue in the library you're using mathiasbynens/emoji-regex#28 |
Hope we can catch those as well .. don't have bandwidth to attack this myself, but maybe you can help (PRs appreciated). |
Yeah, that’s likely the issue. emoji-regex follows the Unicode standard, detecting only official emoji sequences. Apple’s macOS emoji picker randomly inserts U+FE0F after certain emoji despite that resulting in a non-standard sequence. Why would you want to strip emojis, though? They’re perfectly valid in IDs and |
@mathiasbynens unfortunately, that's just how the header links are generated by GitHub.
Generates this anchor:
Should we instead try an opt-in method? That might be a big change though. |
tbh I can live with the current behaviour. Just wanted to add the comment here for future generations to see. Depending on whether the issue gets fixed in the underlying library I'd recommend a Known Issues in the readme though :) I'll try to stick around and PR the docs if needed. |
This never got resolved! Still breaks for me. Can we just drop the emoji or give me an option to? I use emojis in headers here: https://github.com/Miserlou/dnd-tldr |
@Miserlou I think your links will work if you just remove the emojis from the links. I tried modifying the URL fragment on one of your broken links and it worked. |
If I remove the emojis from the links then it breaks in other apps like VSCode's markdown preview. I would like it to work on Github and other apps 🤔 |
The biggest problem is that the behavior is inconsistent. For example This gets quite annoying when automatically generating table of contents, such as I do here: https://github.com/basnijholt/home-assistant-config/blob/35f3ae3942c5d343efe133fccd85415d4bdf6501/README.md#automations---table-of-content |
I also shortened the Index to be more concise. I transformed the Figma prototype and Data Sources into clickable links. Tried out emojis too. Check out this link to add markdown to emoji headers for anchors thlorenz/anchor-markdown-header#36
Is there any news on this issue? This works in VSCode for me: but doesn't on github. It tries to access this URL: |
I'm getting these But hovering the link it shows this: The same that goes to the URL: That is hanpping with multiple emojis: But as others said, I prefer that the emojis was just added as is, not removing like that because it breaks on other softwares. |
#45 should address this by taking a new version of |
Continued from thlorenz/doctoc#123
In short: If you place an emoji into a header, the generated anchor tag does not work.
Current generated output:
The actual link generated by GitHub just leaves out the emoji, but has a dash in there for the space.
So I actually tried it out with a heading like this:
And the Markdown used to make it work:
You can see it here: https://github.com/adrianmcli/next-boilerplate/blob/master/README.md
I took out the emoji from the TOC though, just because I didn't think it looked good.
The text was updated successfully, but these errors were encountered: