Skip to content

Commit

Permalink
Fix media links if referenced multiple times
Browse files Browse the repository at this point in the history
Resolves #2627
  • Loading branch information
Gerrit0 committed Jul 10, 2024
1 parent dae2527 commit d04ea32
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- The page navigation sidebar no longer incorrectly includes re-exports if the same member is exported with multiple names #2625.
- Page navigation now ensures the current page is visible when the page is first loaded, #2626.
- If a relative linked image is referenced multiple times, TypeDoc will no longer sometimes produce invalid links to the image #2627.
- Comments on re-exports are now rendered.

### Thanks!
Expand Down
4 changes: 4 additions & 0 deletions src/lib/models/FileRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export class FileRegistry {
const absolute = this.mediaToPath.get(id);
if (!absolute) return;

if (this.names.has(id)) {
return this.names.get(id);
}

const file = basename(absolute);
if (!this.nameUsage.has(file)) {
this.nameUsage.set(file, 1);
Expand Down
1 change: 1 addition & 0 deletions src/test/comments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,7 @@ describe("Comment Parser", () => {
] satisfies CommentDisplayPart[]);

equal(files.getName(1), "&a.png");
equal(files.getName(1), "&a.png");
});
});

Expand Down

0 comments on commit d04ea32

Please sign in to comment.