Skip to content

Fix/citation bibtex copy button scaffold - #14387

Merged
cderv merged 4 commits into
quarto-dev:mainfrom
AJBogo9:fix/citation-bibtex-copy-button-scaffold
Oct 27, 2026
Merged

cderv merged 4 commits into
quarto-dev:mainfrom
AJBogo9:fix/citation-bibtex-copy-button-scaffold

Conversation

@AJBogo9

@AJBogo9 AJBogo9 commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

In 1.8 the CSS copy-button hover selector was changed to require a div.code-copy-outer-scaffold parent. Regular code blocks were updated but the citation appendix template was not. The consequence was that the copy button became invisible on BibTeX citation entries. This fix wraps the BibTeX <pre> block in the scaffold div to match.

Closes #13669

Checklist

I have (if applicable):

  • filed a contributor agreement.
  • 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

AJBogo9 added 2 commits May 12, 2026 20:51
In 1.8 the CSS copy-button hover selector was changed to require a
div.code-copy-outer-scaffold parent. Regular code blocks were updated
but the citation appendix template was not, making the copy button
invisible. Wrap the bibtex <pre> in the scaffold div to match.
@AJBogo9
AJBogo9 force-pushed the fix/citation-bibtex-copy-button-scaffold branch from 6d2e847 to 0d31ab0 Compare May 12, 2026 17:53
@posit-snyk-bot

posit-snyk-bot commented May 12, 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 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix, and sorry it took a while to get to it.

I can reproduce #13669 on main: the BibTeX copy button has no icon and sits outside the block. With this PR the icon shows on hover, the button is inside the block, and copying still works.

I'll push a small commit on top before merging, so no need to push anything meanwhile.

The fix ships in 1.11 (QUARTO_VERSION and the issue milestone), so the
entry moves to the Regression fixes section of changelog-1.11.md. It
names v1.8.15 as the release that introduced the regression: 62c7122
added the code-copy-outer-scaffold wrapper to regular code blocks only,
and the copy button icon and position CSS both key on that wrapper.

The smoke-all test checks the BibTeX block and its copy button share the
scaffold. It fails on main with the scaffold missing.

Also removes trailing whitespace in format-html-appendix.ts.
@cderv
cderv merged commit 734f424 into quarto-dev:main Oct 27, 2026
52 checks passed
cderv added a commit that referenced this pull request Oct 27, 2026
With `code-copy: false`, the BibTeX block in the citation appendix still
got a copy button, but clicking it did nothing: clipboard.js and its
setup script are not emitted when code copy is off. #14387 moved the
button inside the block, which made the dead button easier to notice.

The appendix now adds the scaffold, the code-with-copy class and the
button only when code copy is enabled, using the same resolution as the
other code blocks. That resolution moves to formatHasCodeCopy() in
format-html-shared.ts, next to htmlFormatFeatureDefaults(), so the
minimal default stays in one place. The appendix cannot import
format-html.ts without an import cycle, since that module imports the
bootstrap postprocessor, which calls the appendix.

- Gate the BibTeX copy button and its scaffold on code-copy
- Resolve code-copy in one shared helper, not inline in format-html.ts
- Stop createCodeBlock from always adding code-with-copy

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

Copy button missing in Bibtex when using citation

3 participants