facebook / facebook/docusaurus

Normalize heading ids / anchors / hash to lowercase?

Aperta
#9,663 10 commenti 0 reazioni 0 assegnatari Vedi su GitHub
proposal
Lingua principale
TypeScript
Stelle
66.2k
Fork
10k
Merge medio
1g 3h
PR unite (30g)
52

Descrizione

### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).

### Motivation

Docusaurus anchor links are currently case sensitive (noticed by implementing the anchor broken link checker: https://github.com/facebook/docusaurus/pull/9528)

- this works: https://docusaurus.io/docs/next#design-principles
- this fails: https://docusaurus.io/docs/next#Design-Principles

---

Yet, many other sites implement case-insensitive anchors, and those links will usually work:
- https://developer.mozilla.org/en-US/docs/Learn/HTML#see_ALSO
- https://www.markdownguide.org/getting-started/#why-use-MARKDOWN
- https://jekyllrb.com/docs/posts/#including-IMAGES-and-resources
- https://www.11ty.dev/docs/languages/javascript/#proMISE

Note: this is not standard browser behavior, the links won't work with JavaScript disabled.

---

So: should we also implement this?

Considering this is a non-native behavior, it remains better for progressive enhancement to have correct case-sensitive links in the first place.

Should we report links with incorrect case in the anchor broken link checker?
(this won't block https://github.com/facebook/docusaurus/pull/9528 but we can do a follow-up PR)

### Self-service

- [ ] I'd be willing to do some initial work on this proposal myself.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.