quarto-dev / quarto-dev/quarto-cli
Citation hover popup uses unsorted data-cites order instead of rendered CSL order
@cderv is already working on this.
Since Oct 17, 2025.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Description
When rendering citations with author-date CSL styles in Quarto (HTML output), the in-text citation cluster is correctly sorted according to the CSL <sort> rules (e.g., alphabetical by author). However, the hover popup (the tooltip showing full reference entries) displays items in the original citation order from Markdown, not the sorted display order.
This produces inconsistent and confusing results: the text and the tooltip list the same references in different orders.
Example
Source Markdown
[@lipman1997; @dikotter2015; @gladney2004]
Expected output (APA / author-date):
Text (correct):
(Dikötter, 2015; Gladney, 2004; Lipman, 1997)
Hover popup (expected to match text):
Dikötter F (2015)…
Gladney DC (2004)…
Lipman JN (1997)…
Actual hover popup (unsorted):
Lipman JN (1997)…
Dikötter F (2015)…
Gladney DC (2004)…
Diagnosis
Quarto builds citation tooltips from the data-cites attribute in the HTML:
<span class="citation" data-cites="lipman1997 dikotter2015 gladney2004">
…
</span>
Pandoc correctly sorts the inline text, but Quarto’s tooltip logic reads data-cites as originally typed, not in the rendered order.
Thus, the popup order diverges from the visible citation order whenever the CSL style defines a <sort>.
Expected Behavior
The hover popup should respect the sorted CSL order—i.e., the same order that appears in the rendered citation text.
Steps to Reproduce
- Use any author–date CSL style that defines a
<citation><sort>(e.g. apa.csl). - Create a
.qmdfile with the example citation above. - Render to HTML (
quarto render example.qmd). - Hover over the citation cluster: the popup order differs from the visible order.
Environment
$ quarto check
Quarto 1.9.3
[✓] Checking environment information...
Quarto cache location: /Users/username/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.6.3: OK
Dart Sass version 1.87.0: OK
NOTE: Deno version 2.4.5 does not strictly match 2.3.1 and strict checking is enabled. Please use 2.3.1.
Typst version 0.13.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 1.9.3
Path: /Applications/quarto/bin
[✓] Checking tools....................OK
TinyTeX: v2025.10
Chromium: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/username/Library/TinyTeX/bin/universal-darwin
Version: 2025
[✓] Checking Chrome Headless....................OK
Using: Chrome found on system
Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Source: MacOS known location
[✓] Checking basic markdown render....OK
[✓] Checking Python 3 installation....OK
Version: 3.12.2
Path: /Users/username/.pyenv/versions/3.12.2/bin/python3
Jupyter: 5.8.1
Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking R installation...........OK
Version: 4.5.1
Path: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources
LibPaths:
- /Users/username/.R/packages
- /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
knitr: 1.49
rmarkdown: 2.29
[✓] Checking Knitr engine render......OK
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.