-
-
Notifications
You must be signed in to change notification settings - Fork 737
Anchor name conflicts when type names differ only by capitalization #1585
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
Comments
Is there a good place I should get started looking to fix this? Or is a big, overhaul-type task that requires creating an entirely new subsystem to generate anchor names? Or somewhere in-between? Not having looked at the code, I imagine that typedoc should generate a mapping from symbol to anchor name, generating them on-demand, and handling duplicates. It will need to understand that duplicates can only happen if the 2 anchors are on the same page. Alternatively, when I modify one of the anchors to be capitalized, my browser handles them correctly. If this is standard browser behavior, perhaps we can simply remove the |
I was able to fix the issue using this patch: https://github.com/cspotcode/typedoc/compare/master..patch-2 I'm using it to build the ts-node website here: https://github.com/TypeStrong/ts-node/blob/50e2ce0e0dfd530744415bebe500dcf04ec43fd8/.github/workflows/website.yml#L19-L21 So far it appears to be working. html filenames and URLs are capitalized to match the types. I don't know if I have accidentally broken something in the process. |
Yep, unless you care about IE. Which... I don't. This is.. probably somewhere in between. In HTML 4 and earlier, two anchors that differed only in case were invalid (https://www.w3.org/TR/html401/struct/links.html#h-12.2.3)... so apparently whoever wrote this piece of code decided to avoid that by making them all lowercase? Your patch shouldn't break anything, but is only half of the fix... it will still break if someone does this: export function foo() {}
export type foo = 123 Properly fixing this is a bigger issue. I'd be happy to merge your fix since it's an improvement on what is there currently. |
Resolves #1585 Co-Authored-By: Andrew Bradley <[email protected]>
Search terms
header id conflicts
anchor conflict
Expected Behavior
On a page with two types
Foo
andfoo
, header links correctly link to both.Actual Behavior
Typedoc generates anchors by converting both to lowercase, so links to
foo
will erroneously showFoo
.Both anchors use lowercase:
Steps to reproduce the bug
The behavior occurs here for the
Register
andregister
types. Links that should go toregister
go instead toRegister
.https://typestrong.org/ts-node/api/index.html
This was mentioned by Gerrit0 here: #1135 (comment)
Since it is already a known issue, I assume a smaller reproduction is not needed, but I can create one.
Environment
The text was updated successfully, but these errors were encountered: