Skip to content

Fix Google Scholar references missing for a bare YAML bibliography - #15128

Merged
cderv merged 3 commits into
mainfrom
fix/scholar-bare-yaml-58sl
Oct 20, 2026
Merged

cderv merged 3 commits into
mainfrom
fix/scholar-bare-yaml-58sl

Conversation

@cderv

@cderv cderv commented Oct 20, 2026

Copy link
Copy Markdown
Member

With google-scholar: true and a YAML bibliography not wrapped in --- delimiters, the document renders fine but no citation_reference tags are written for the cited works:

references:
- id: smith2024
  type: article-journal
  title: A title

Follow-up to #15125, which fixed the same conversion for a CSL JSON bibliography. CSL YAML with --- delimiters works today, which is why the YAML case looked fine there.

Root cause

The Scholar metadata converts each bibliography with pandoc <file> -t csljson. Pandoc has no reader for a YAML bibliography, so a .yaml file is read as markdown, and only a delimited file is seen as a metadata block. Pandoc citeproc reads it differently: --bibliography takes the first YAML document, either a map with references or a top-level list of references. Both bare forms work for citations but give an empty list here.

There is no -f to pass for this, as was done for .json.

Fix

For .yaml and .yml, a first YAML parse only tells the two shapes apart, and Pandoc still reads the fields:

  • a references: map goes through --metadata-file, which accepts it with or without delimiters
  • a top-level list is wrapped as {references: ...} in a metadata block on stdin, as --metadata-file needs a map

Pandoc doing the field parsing keeps markdown in titles and values like an unquoted volume: 1.10 the same as in the delimited case. Converting the YAML to CSL JSON on our side was not used for that reason. The shape check accepts any YAML tag and keeps the last value of a duplicate key, like Pandoc, so delimited files that worked before still do.

Not a regression, this conversion is the same since at least v1.4.

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: local clone, DeepWiki MCP
  • 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.

cderv added 2 commits October 20, 2026 14:48
With google-scholar enabled, a YAML bibliography that is not wrapped in
--- delimiters produced no citation_reference tags. The Scholar metadata
ran `pandoc <file> -t csljson`, and pandoc has no reader for a YAML
bibliography: it falls back to markdown, which only finds references in
a delimited metadata block. pandoc --bibliography accepts the bare forms,
so documents rendered fine but lost their Scholar references.

Read .yaml/.yml files the way --bibliography does, from the first YAML
document. A references: map goes through --metadata-file, so pandoc's
YAML reader handles it unchanged. A top-level list is wrapped in a
metadata block on stdin, as --metadata-file needs a map; its fields are
still parsed by pandoc, so markdown titles and unquoted numbers behave as
they do in the map form.

The shape check uses the failsafe schema with json: true, so a duplicate
key keeps the last value as pandoc does instead of failing the render.

See #15125
Pandoc reads a YAML bibliography with any tag, standard (!!int, !!null)
or custom (!foo), and keeps the value's text. The failsafe schema used
to tell a references: map from a top-level list knows only str, seq and
map, so a tagged value threw "unknown tag" and the Scholar references
were dropped, including for delimited files that worked before.

Extend the failsafe schema with a catch-all type per kind that keeps
the untagged value. QuartoJSONSchema doesn't fit here: its implicit
number types would turn an unquoted 1.10 into 1.1 on the list path,
and it still rejects custom tags.
@posit-snyk-bot

posit-snyk-bot commented Oct 20, 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 d0bc2d9 into main Oct 20, 2026
51 checks passed
@cderv
cderv deleted the fix/scholar-bare-yaml-58sl branch October 20, 2026 14:01
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.

2 participants