diff --git a/news/changelog-1.2.md b/news/changelog-1.2.md index 390ab87077..7d4f7e250c 100644 --- a/news/changelog-1.2.md +++ b/news/changelog-1.2.md @@ -47,9 +47,10 @@ - Handle CNAME file for `gh-pages` either without or without protocol prefix (e.g. https://) -## Bibliographies +## Bibliographies and Citations - Support formats `bibtex`, `biblatex`, and `csljson`. When rendered to one of these formats any citations within the document will be rendered as the specified bibliography format. +- Always add citeproc filter if `citeproc: true` is specified, even if there isn't a bibliography or references in the document (#2294) ## Miscellaneous diff --git a/src/command/render/filters.ts b/src/command/render/filters.ts index bcc8846784..c75b4642e1 100644 --- a/src/command/render/filters.ts +++ b/src/command/render/filters.ts @@ -582,13 +582,29 @@ function citeMethod(options: PandocOptions): CiteMethod | null { // no handler if no references const pandoc = options.format.pandoc; const metadata = options.format.metadata; + + // determine the engine, if provided + const engine = bibEngine(options.format.pandoc, options.flags); + + // If the user is explicitly enabling citeproc: true, use this as the citemethod + // even when there may be no bibliography (see + // https://github.com/quarto-dev/quarto-cli/issues/2294 for an example of why) + if (pandoc.citeproc) { + // If both citeproc and a bib engine are specified, throw an error + if (engine) { + throw new Error( + `The bibliography engine '${engine}' was set when 'citeproc' was also explicitly requested.`, + ); + } + + return "citeproc"; + } + + // No bibliography or refences, and no explicit request, so no engine specified if (!metadata[kBibliography] && !metadata.references) { return null; } - // collect config - const engine = bibEngine(options.format.pandoc, options.flags); - // if it's pdf-based output check for natbib or biblatex if (engine) { return engine;