Giter Site home page Giter Site logo

Comments (10)

wooorm avatar wooorm commented on June 1, 2024

Which one is wrong? What's the actual and what's the expected?

from rehype-slug.

github-actions avatar github-actions commented on June 1, 2024

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.

michael-jeulinl avatar michael-jeulinl commented on June 1, 2024

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.

wooorm avatar wooorm commented on June 1, 2024

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.

iBobik avatar iBobik commented on June 1, 2024

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.

wooorm avatar wooorm commented on June 1, 2024

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.

iBobik avatar iBobik commented on June 1, 2024

from rehype-slug.

wooorm avatar wooorm commented on June 1, 2024

Please make a reproduction. And read the thread. I tried that, it worked.

from rehype-slug.

michael-jeulinl avatar michael-jeulinl commented on June 1, 2024

Actually, I have found that the problem occurs when you pipeline rehype-slug with rehype-format.
Try removing rehype-format.

from rehype-slug.

wooorm avatar wooorm commented on June 1, 2024

Please make a reproduction. I don't believe rehype-format touches IDs

from rehype-slug.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.