A Typst project render cannot find the bibliography file in `output-dir`

未关闭
#1,011 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust
领域
tooling

调研方向

Start in crates/quarto-core/src/transforms/resource_collector.rs, where the issue says resource copies are collected from the document AST, and compare that with the flush-before-compile step in crates/quarto-core/src/pipeline.rs. Run the provided reproduction with citeproc: false and output-dir: _site; done means references.bib is available beside _site/index.typ and rendering produces _site/index.pdf.

由索引模型根据 Issue 内容生成。

描述

Bug description

In a project with output-dir: _site, a Typst document with bibliography: references.bib and citeproc: false fails on q2, and Quarto 1 renders it.
The generated _site/index.typ contains #bibliography(("references.bib")), but q2 never copies references.bib into _site, so typst compile cannot open it.

q2 already flushes the collected resource copies before the Typst compile step, which fixed the same failure for images:

https://github.com/quarto-dev/q2/blob/a2a1cb948b1aec42c93200b880dc73567160f691/crates/quarto-core/src/pipeline.rs#L803-L813

The collector that builds those copies walks the document AST for image targets.
A bibliography: value sits in the metadata, so no copy is queued for it:

https://github.com/quarto-dev/q2/blob/a2a1cb948b1aec42c93200b880dc73567160f691/crates/quarto-core/src/transforms/resource_collector.rs#L466-L478

With citeproc: true the failure does not appear, because q2 resolves the citations itself and no #bibliography call is written.
The cause is my reading of the source.
The run confirms the missing file, and I have not checked that a queued copy fixes it.

Steps to reproduce

_quarto.yml:

project:
  output-dir: _site

index.qmd:

---
format: typst
bibliography: references.bib
citeproc: false
---

[@a]

references.bib:

@book{a, title={A}, author={B}, year={2000}}

With q2:

q2 render

With Quarto 1:

quarto render
Actual behavior

q2 fails and leaves only _site/index.typ:

Error [Q-21-3]: typst compile exited with exit status: 1:
error: file not found (searched at /private/tmp/q2-typst.AqB0/_site/references.bib)
    ┌─ _site/index.typ:438:14
    │
438 │ #bibliography(("references.bib"))
    │               ^^^^^^^^^^^^^^^^^^

Quarto 1 writes _site/index.pdf.

Expected behavior

q2 copies references.bib next to _site/index.typ before it compiles, so _site/index.pdf is written, as in Quarto 1.

Your environment
  • q2: Q2 (quarto 2) 0.40.0-nightly.20261101 (nightly built from a2a1cb9).
  • Quarto 1 for comparison: 1.12.0 (pre-release).
  • OS: macOS 27.2 (arm64).
  • Terminal, no IDE.
主要语言
Rust
星标
302
派生
22
平均合并
5 小时 2 分钟
30 天内合并 PR
213

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

quarto-dev/q2 的其他 Issue

查看 quarto-dev/q2 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。