renderthis
renderthis copied to clipboard
Can't render a qmd presentation
Hi all,
I have a qmd/revealjs presentation, but I have customised the theme and have created a template. The slides compile perfectly, but when I try to pdf them using renderthis
I get a message
Error in to_pdf_complex(path_from(step_html, "url"), output_file, partial_slides, :
Input does not appear to be xaringan or quarto slides:
I think this gets triggered by the check in
has_remark <- b$Runtime$evaluate("typeof slideshow !== 'undefined'")$result$value
if (!has_remark) {
stop("Input does not appear to be xaringan or quarto slides: ", input)
}
Not sure how to deal with this though...
I'm testing this on a html file output by quarto both locally and deployed online (https://giabaio.github.io/test-quarto). Sorry if I'm missing an obvious point!
Thanks for your help! Gianluca
Sorry to come back to this, but does anybody have some more insight into this? The qmd presentation gets parsed OK (a bit worse than what was happening for xaringan slides, I think...) onto pdf, if I don't use the complex_slides/partial_slides options, but it still fails otherwise...
(I appreciate the summer has got in the way --- and people have way better things to do than obsessively look at the issues on their GitHub repo!... :-)) Thanks! Gianluca
We've been dealing with other issues trying to get the package on CRAN. It was just removed from CRAN yesterday due to a remaining obscure note in the checks that we have yet to solve. Our current plan for further development is to get this back on CRAN, then add support for handouts, then start working on Quarto support. So eventually we'll get to this. I suspect there are several things we will need to change to get Quarto slides more properly supported.
Thank you, @jhelvy! Like I said, I appreciate that life gets in the way and dealing with repos is way more work than you bargain for, when you set it up!... :-)
In the medium term:
- Render your slides using the Render button or
quarto render
. - Apply
renderthis::to_pdf()
to the rendered html:renderthis::to_pdf("slides.html")
- The default
to_pdf()
should work, but note that you cannot enablecomplex_slides
orpartial_slides
since those are both tightly coupled to xaringan slides.
Thanks, @gadenbuie --- yes: that more or less works (like I said, slightly worse than what was happening for xaringan slides, but that will do!).
This should (hopefully) be resolved now with v0.2.0 now on CRAN.
Thank you. It does plough through (without complex or partial slides, as @gadenbuie said) and it does OK-ish... It struggles, I think, when the underlying quarto file has too much customisation/added components? See if these two (relatively manipulated and restructured qmd/css files) help debug?
- https://gianluca.statistica.it/slides/vibass-2022/index.html
- https://gianluca.statistica.it/slides/ispor-2022
I think some issues may be quarto-related quirks that don't directly affect xaringan... Happy to help (if I can...).
Yeah it shouldn't be any different from opening the Quarto slides in Chrome and printing to PDF. If you see discrepancies between to_pdf()
and manual printing in Chrome, it might be our fault (or we might be able to fix it). In places where the output is the same but not what you want, your best bet is to report it to Quarto.
Yes. I think Chrome would give the same output as to_pdf
so that's a quarto quirk... It renders very well to pdf when the slides are fairly basic (and don't deviate from the default revaljs structure, I think...). My slides have a heavily customised title page (which struggles to render properly) and some other features produce empty pages etc...
All in all, I think this is a part where xaringan still does better in terms of then rendering to pdf. But thanks for your awesome work!
Maybe try to set the "suffix" ?print-pdf
, e.g., my-file.html?print-pdf
(see https://revealjs.com/pdf-export/).
This is what pagedown
is using, thus what renderthis
is using.
mmm... Not sure I am making this wrong, but if I try
renderthis::to_pdf("https://gianluca.statistica.it/slides/ispor-2022/bcea/index.html?print-pdf",to="slides.pdf",complex_slides = T,partial_slides = T)
I get
Error:
from must have extension: .rmd, .qmd
Can you please clarify what you mean @mcanouil? Thanks!
When you use Chrome, add the ?print-pdf
in the URL, because pagedown
is basically doing that (i.e., no need of ?print-pdf
inside a call to renderthis
or pagedown::chrome_print()
).
Thank you. I've tried with this
https://gianluca.statistica.it/slides/ispor-2022/bcea/index.html?print-pdf
but the results aren't great... Some of the pages render OK, but others are just rendered as blank pages or worse...
I think the advice being offered is mostly around what's possible in terms of printing to PDF. If the slides don't look great when printing to PDF from Chrome, then that's a problem with the framework being used to create the slides — renderthis doesn't (and can't) do much more than coordinate printing via Chrome. So even more concretely, if your Quarto or xaringan slides don't look great when you print them in Chrome, please report those problems in the Quarto or xaringan repos.
Thank you, @gadenbuie - I think xaringan
doesn't have any issues (at least with my own template) and the printing-to-pdf (via renderthis
or manual) is pretty solid... My quarto
template struggles and, like you say, it's probably an issue with how quarto
handles some customisation...
Thank you all for looking into this! Appreciate it! :pray: