Skip to content

Fix format-links object entries adding a duplicate link - #15312

Merged
cderv merged 1 commit into
mainfrom
fix/issue-9606
Nov 6, 2026
Merged

cderv merged 1 commit into
mainfrom
fix/issue-9606

Conversation

@cderv

@cderv cderv commented Nov 6, 2026

Copy link
Copy Markdown
Member

When format-links lists 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() in src/format/html/format-html-links.ts adds a default link for every rendered format unless format-links contains 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):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: DeepWiki MCP, local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

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
@posit-snyk-bot

posit-snyk-bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv merged commit 38e34ec into main Nov 6, 2026
51 of 52 checks passed
@cderv
cderv deleted the fix/issue-9606 branch November 6, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

format-links create a new link instead of renaming

2 participants