Open bbartholdy opened 2 years ago
Thanks for reporting this! Fixed here 57d6f2f5eb1958a0d04b8eb7a3d768f24ad516e3 and a fresh release is on the way.
Error has been resolved!
I just wanted to check if the following is expected behaviour:
The left side is the pdf output based on the following conditional content:
::: {.content-visible when-format="html"}
# A Chapter only for HTML
Will only appear in HTML.
## Introduction
This is a book created from markdown and executable code.
See @knuth84 for additional discussion of literate programming.
:::
The text is left out of the pdf format but the level 1 heading is still there.
@dragonstyle I think this is b/c we are taking the first header in partitiionMarkdown
-- I wonder if need to be slightly more choosey and only take the header if its the first thing in the file?
I think there are some challenges to creating conditional chapters in this way (for example, if you were to try to create a PDF only chapter you'd end up with empty untitled pages in web or epub output). This sort of 'happens' to work for PDF chapters because of how we generate the book LaTeX, but it seems risky to rely upon.
Without proprocessing the _quarto.yml
I don't know how to add a chapter to only one format, but pehaps @jjallaire has ideas here...
Regarding adding different set of chapters from different output format, bookdown configuration rmd_files
, which is used to select the files to includes in the book, supports specifying a different set by format.
Reminder: the default in bookdown is to include all (R)md file found not prefixed by underscore. The rmd_files
key is used to change this default behavior.
Search rmd_files
in here for context: https://bookdown.org/yihui/bookdown/usage.html
Not sure how complex it would be to support this type of configuration in our YAML. (unless it already exists ? I missed the doc in this case)
Non we don't support that currently in YAML but we certainly could. I'm going to target this for post v1.0.
Just stumbled upon this very issue when trying to 'exclude' the index.md
in non-HTML output. An index file is mandatory for books currently, but I do not need that output in the PDF.
::: {.content-visible when-format="html"}
# Preface {.unnumbered}
This is a webpage version of the PDF documentation for your convenience.
:::
Same issue arises for references, I use biblatex
for PDF output and a custom bibliography.md
(alongside an empty biblio.tex
partial to remove the default behaviour)
:::: {.content-visible when-format="html"}
# Bibliography
::: {#refs}
:::
::::
\printbibliography
\clearpage
\pagenumbering{Roman}
This results in an additional empty 'Bibliography' chapter in PDF output, followed by the actual bibliography.
Just to give a few more examples where a complete 'content-removed when not condition' would be appreciated.
@dragonstyle Let's take a look at this later on today to see if there isn't something simple we can do (I think we need a local repro that illustrates the problem so we can reason about it better). It seems like excluding content from PDFs should be much easier than excluding pages from the HTML website.
I've got an example repo reproducing another manifestation of this issue (with latest "99.9.9" dev version). The .content-hidden
is ignored when rendering pdf, dumps raw HTML straight into index.tex
, and fails compilation. A solution would be really appreciated!
@mpadge I can't reproduce your example repo. Maybe we can discuss in an issue in your example repo ? I opened https://github.com/mpadge/quarto-test/issues/1 to discuss.
I think this is b/c we are taking the first header in
partitiionMarkdown
-- I wonder if need to be slightly more choosey and only take the header if its the first thing in the file?
@jjallaire Is #3681 also caused by this?
OS: Pop!_OS 22.04 LTS x86_64 Quarto version: 0.9.550
Minimal example to reproduce error:
Add conditional content to bottom of intro.qmd:
Render book:
Encountered error:
Output of
quarto check
The last version (that I know of) that did not produce an error was 0.9.426