Repository navigation
Fix format-links object entries adding a duplicate link - #15312
Merged
Merged
Conversation
A `format-links` entry like `{format: typst, text: PDF}` added the renamed
link, then the default link for every rendered format was added as well,
because only plain string entries stop the default links. Each renamed
format showed twice: once with the custom text, once with its default name.
Rendered formats already linked by a `{format}` entry are now skipped when
the default links are added. Other rendered formats keep their default link,
and plain string entries still make `format-links` an explicit list.
Counting `{format}` entries like plain strings would also fix the duplicates,
but it drops the link to every rendered format not listed. A GitHub code
search found a public document that would lose its whole "Other Formats"
section that way, so that option was not taken.
Fixes #9606
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This was referenced Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
format-linkslists a format as an object to rename its link, for example{format: typst, text: PDF}, "Other Formats" shows the renamed link and then the same format again under its default name. With html, typst and docx rendered and both other formats renamed, the list is PDF, Word, Typst, MS Word instead of PDF, Word.Root cause
After adding the user's entries,
alternateLinks()insrc/format/html/format-html-links.tsadds a default link for every rendered format unlessformat-linkscontains a plain string entry. Object entries are not counted, so a renamed format also gets its default link. This has been the case since the object form was added in v1.4.Fix
Formats already linked by a
{format, text}entry are skipped when the default links are added. Other rendered formats keep their default link, plain string entries still restrict the list to the formats named, and{text, href}links still add to the default links.Counting object entries like plain strings was considered, but it would also remove the link to every rendered format not listed. A GitHub code search turned up a public document that would lose its whole "Other Formats" section that way.
Fixes #9606
Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.