quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.54k stars 292 forks source link

CLI does not recognize multiple output formats in Quarto projects #5947

Open matthew-brett opened 1 year ago

matthew-brett commented 1 year ago

Bug description

quarto render index.qmd --to pdf,html fails with ERROR: Unknown format pdf,html - but it seems that should work.

Steps to reproduce

I suppose you could reproduce with any document, but try:

git clone https://github.com/matthew-brett/test-quarto
cd test-quarto
quarto render index.qmd --to pdf,html

Expected behavior

Quarto should render the given document or directory to both PDF and HTML formats.

Actual behavior

ERROR: Unknown format pdf,html

Stack trace:
    at resolveFormats (file:///Users/mb312/dev_trees/quarto-cli/src/command/render/render-contexts.ts:591:13)
    at eventLoopTick (ext:core/01_core.js:181:11)
    at async renderContexts (file:///Users/mb312/dev_trees/quarto-cli/src/command/render/render-contexts.ts:231:19)
    at async Object.bookIncrementalRenderAll [as incrementalRenderAll] (file:///Users/mb312/dev_trees/quarto-cli/src/project/types/book/book-render.ts:646:22)
    at async renderProject (file:///Users/mb312/dev_trees/quarto-cli/src/command/render/project.ts:120:5)
    at async Command.fn (file:///Users/mb312/dev_trees/quarto-cli/src/command/render/cmd.ts:212:26)
    at async Command.execute (file:///Users/mb312/dev_trees/quarto-cli/src/vendor/deno.land/x/cliffy@v0.25.4/command/command.ts:1790:7)
    at async quarto (file:///Users/mb312/dev_trees/quarto-cli/src/quarto.ts:135:3)
    at async file:///Users/mb312/dev_trees/quarto-cli/src/quarto.ts:167:5

Your environment

Macos Ventura 13.4 Latest quarto-cli commit 1f3581304

Quarto check output

$ quarto check 

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.2: OK
      Dart Sass version 1.55.0: OK
      Deno version 1.33.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      Path: /Users/mb312/dev_trees/quarto-cli/package/dist/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.10.11
      Path: /Users/mb312/.virtualenvs/resampling-with/bin/python3
      Jupyter: 5.3.0
      Kernels: python3, ir

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.3.0
      Path: /opt/homebrew/Cellar/r/4.3.0_1/lib/R
      LibPaths:
        - /Users/mb312/Library/R/arm64/4.3/library
        - /opt/homebrew/lib/R/4.3/site-library
        - /opt/homebrew/Cellar/r/4.3.0_1/lib/R/library
      knitr: 1.42
      rmarkdown: 2.21

[✓] Checking Knitr engine render......OK
mcanouil commented 1 year ago

Thank you for the report.

I can reproduce, but it seems to be because it is a book. Try to remove/rename _quarto.yml and you'll see the command works as intended.

matthew-brett commented 1 year ago

Thanks - yes - if I remove _quarto.yml, the command works.

However, if I add even:

project:
  title: "foo"

as _quarto.yml - the problem returns.

mcanouil commented 1 year ago

Thanks, so the issue more general than books, it is when rendering multiple formats in a "project". @matthew-brett Could you rename the issue to make it clear it is within a "Quarto project"?

apsteinmetz commented 11 months ago

I get the same result rendering from RStudio. The yaml header in the qmd document will only render the first format in the list, regardless of the order.

format: 
   html: default
   docx: default
   pdf:
      documentclass: article
      papersize: letter
mcanouil commented 11 months ago

Does RStudio not have the render all which was added few months ago?

VSCode

Regarding Quarto CLI, when in a Quarto project (defined by the presence of _quarto.yml):

quarto render --to all
cderv commented 11 months ago

Does RStudio not have the render all which was added few months ago?

I think it is still a feature request to have a Render All button for document : https://github.com/rstudio/rstudio/issues/13332

mcanouil commented 11 months ago

Maybe, as in the RStudio feature request, the "render" button in. SCode should not be called "render" as it actually "renders and preview" and uses quarto preview command.

cderv commented 11 months ago

@mcanouil Should be an issue for https://github.com/quarto-dev/quarto if you want to discuss this.

cderv commented 5 months ago

Just some notes as there was another report in https://github.com/quarto-dev/quarto-cli/discussions/8394#discussioncomment-8224825 and I was to open a new issue.

metadata document-css: false link-citations: true date-format: long lang: en title: test

pandoc: pdf: withBinaryFile: does not exist (No such file or directory)


* Quarto 1.4 is working for single document (1.3 issue fixed), but non working within project with the issue from OP