-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-remark-autolink-headers): remove accents from anchors #11575
Conversation
This is potentially breaking change (links would potentially change). It's not a blocker - just documenting that we would need bump major version for this change. I feel like change like this warrant adding some tests to cover cases of headings with accent characters to make sure we don't introduce regressions later on. |
I'm not sure on this, but are accented characters invalid as element IDs / link targets? If it's not invalid maybe instead of breaking change we could add plugin option to convert to latin (or whatever @sindresorhus/slugify does)? |
So did some code reading and it seems we can add option to optionally use https://lodash.com/docs/4.17.11#deburr to remove accents |
@pieh thanks for taking a look! |
@pieh I think your solution to keep the github slugger thing, and optionally use lodash deburr to remove accents is good. I still think removing accents should be the default behavior, what do you think about introducing this as a feature for now and as a breaking change if we want to later? |
This sounds perfect to me! We just don't have enough data to make informed decision for all the people, but at least providing option would unblock people that definitely want this behaviour. |
bf37cc1
to
6b17c9c
Compare
6b17c9c
to
4c05f73
Compare
@pieh I made some changes, let me know if there's anything wrong! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I love that removeAccents
is optional.
Holy buckets, @windkomo — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
Removing accent characters from URLs (and thus anchors links) seems preferable to me.
What do you guys think?