quarto-dev/quarto-cli

Conditional Content for Multiple Formats (Works only for last format listed)

Closed this issue · 4 comments

Bug description

According to Q&A #2704, it should be possible to apply conditional content to multiple formats:

::: {.content-hidden when-format="html" when-format="pdf"}

Should not appear in HTML or PDF.

:::

However, conditional content is in fact carried out only for the format listed last (PDF in the example above), rather than all the formats listed.

Steps to reproduce

# Preface {.unnumbered}

This is a Quarto book.

::: {.content-hidden when-format="epub" when-format="pdf"}

To learn more about Quarto books visit <https://quarto.org/docs/books>.

:::
project:
  type: book

book:
  title: "conditional_content"
  author: "Norah Jones"
  date: "11/4/2024"
  chapters:
    - index.qmd
    - intro.qmd
    - summary.qmd
    - references.qmd

bibliography: references.bib

format:
  html:
    theme: cosmo
  pdf:
    documentclass: scrreprt
  epub: default

Expected behavior

Conditional content should be applied to all formats requested (e.g., "To learn more about Quarto books visit https://quarto.org/docs/books." should not be in both the epub and pdf)

Actual behavior

Conditional content is applied only to the last format listed (e.g., "To learn more about Quarto books visit https://quarto.org/docs/books." is not in the pdf but it is in the epub)

Your environment

  • IDE: VSCode: Version: 1.95.1 (user setup)
  • OS: Windows_NT x64 10.0.19045

Quarto check output

Quarto 1.6.4
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.6.4
      Path: C:\Users\amazel\AppData\Local\Programs\Quarto\bin
      CodePage: 1252

[>] Checking tools....................OK
      TinyTeX: v2024.07.03
      Chromium: 869685

[>] Checking LaTeX....................OK
      Using: TinyTex
      Path: C:\Users\amazel\AppData\Roaming\TinyTeX\bin\windows\
      Version: 2024

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

[>] Checking Python 3 installation....OK
      Version: 3.11.4
      Path: C:/Users/amazel/AppData/Local/Programs/Python/Python311/python.exe
      Jupyter: 5.5.0
      Kernels: ir, python3

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

[>] Checking R installation...........OK
      Version: 4.4.2
      Path: C:/PROGRA~1/R/R-44~1.2
      LibPaths:
        - C:/Program Files/R/R-4.4.2/library
      knitr: (None)
      rmarkdown: (None)

      The knitr package is not available in this R installation.
      Install with install.packages("knitr")
      The rmarkdown package is not available in this R installation.
      Install with install.packages("rmarkdown")

Could you upgrade your version of Quarto? You are using an outdated pre-release.

Could you upgrade your version of Quarto? You are using an outdated pre-release.

Done! Thank you for bringing this to my attention. However, upgrading to 1.6.32 unfortunately did not fix the problem

I can repro and see the bug. We'll fix this for 1.6.