Heading anchor slug does not respect GitHub behavior due to emojis #9194
Labels
bug
An error in the Docusaurus core causing instability or issues with its execution
good first issue
If you are just getting started with Docusaurus, this issue should be a good place to begin.
Heading anchor slug does not respect GitHub behavior due to emojis
Discussed in #9193
Considering the heading
## :smiley: This is a friendly header
#smiley-this-is-a-friendly-header
for your headerOur slugger package is supposed to align with GitHub and seems to work as intended (the input heading string is not supposed to contain the leading space):
The MDX Playground shows the heading is parsed this way, and it's the value we pass to our slugger:
What I understand:
😃 This is a friendly header
We should probably use node-emoji to "unconvert the value" before passing it to the slugger.
The problem is that we shouldn't always unemojify 😅
If you look at the GitHub behavior, it has a different slugging behavior if we use
😃
or:smiley:
in a heading:See https://gist.github.com/slorber/9c499bb934434a3f7ac6603eff6647d3#-this-is-a-friendly-header-real-smiley
We should align to this behavior, but I'm not sure how 😅
The solution would be to get the "original" heading string value before remark-emoji gets applied. I'm not sure remark-emoji outputs that original value currently.
The text was updated successfully, but these errors were encountered: