facebook / facebook/docusaurus

Normalize heading ids / anchors / hash to lowercase?

Open
#9,663 10 comments 0 reactions 0 assignees View on GitHub
proposal
Dominant language
TypeScript
Stars
66.2k
Forks
10k
Avg merge
1d 3h
Merged PRs (30d)
52

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.