Comments (10)
Which one is wrong? What's the actual and what's the expected?
from rehype-slug.
Hi! Thanks for taking the time to contribute! This has been marked by a maintainer as needing more info. It’s not clear yet whether this is an issue. Here are a couple tips:
- Spend time framing the issue! The more time you put into it, the more we will
- Often, maintainers respond with why for several back and forths; rubber duck debugging might help avoid that
- Folks posting issues sometimes fall for xy problems: asking for a certain solution instead of raising the root problem
Thanks,
— bb
from rehype-slug.
Both are containing accents:
<a class="toc-link toc-link-h1" href="#title-efé">
<h1 id="title-efé">title efé</h1>
According to the specification : https://url.spec.whatwg.org/#concept-url-fragment
An URL fragment is ASCII-only (no "international characters" accepted directly).
The link containing the anchor #title-efé is broken.
from rehype-slug.
Both are containing accents
You should try this HTML out in a browser and observe that it works.
According to the specification : url.spec.whatwg.org/#concept-url-fragment
An URL fragment is ASCII-only (no "international characters" accepted directly).
You reference the URL
spec, which defines URL
objects, (and more importantly the reading part not the writing part), that spec does not define what values are allowed inside href
on a
in the HTML spec, nor how URLs work on the larger web.
Non-ASCII values are allowed in URLs, which you can observe by passing them to URL
:
(new URL('https://example.com/#🤷')).hash // #%F0%9F%A4%B7%E2%80%8D
^-- this shows that the URL
class reading that you linked supports non-ASCII characters as input, and creates the ASCII-only hash
you linked with percent-encoding.
Practically too, in these projects we follow the algorithm that GitHub uses. GitHub uses those accents. If you feel that they’re horrible wrong, go take it up with them.
from rehype-slug.
I have the same issue - it generated this slug which does not work in Safari: "začneme-tou-prvn%C3%AD-otázkou-kdo-jsem"
Also here people mentioned similar issue in Firefox: nuxt/content#835
So it is not OK to have this characters in URL.
from rehype-slug.
The problem is nuxt. The problem is not this package. This package does not generate links. Using the IDs generated here in a URL is fine.
from rehype-slug.
from rehype-slug.
Please make a reproduction. And read the thread. I tried that, it worked.
from rehype-slug.
Actually, I have found that the problem occurs when you pipeline rehype-slug with rehype-format.
Try removing rehype-format.
from rehype-slug.
Please make a reproduction. I don't believe rehype-format touches IDs
from rehype-slug.
Related Issues (11)
- Support manual custom IDs HOT 3
- Handle titles starting with numbers HOT 4
- Add option for adding a prefix HOT 3
- add a new option to treat no-break spaces as whitespace (and yield dashes in their place) HOT 2
- Why not support a pluggable `option.slug` function (or `options.slugger` implementation)? HOT 9
- Option to capitalize slugs HOT 5
- Typescript typings for this plugin HOT 3
- Types introduced in v4 aren't exposed via the package.json
- Add support for 'German' umlaute HOT 2
- Customize which headings are included HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rehype-slug.