Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't render a qmd presentation #62

Open
giabaio opened this issue Aug 3, 2022 · 15 comments
Open

Can't render a qmd presentation #62

giabaio opened this issue Aug 3, 2022 · 15 comments

Comments

@giabaio
Copy link

giabaio commented Aug 3, 2022

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

@giabaio
Copy link
Author

giabaio commented Sep 6, 2022

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

@jhelvy
Copy link
Owner

jhelvy commented Sep 6, 2022

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.

@giabaio
Copy link
Author

giabaio commented Sep 6, 2022

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!... :-)

@gadenbuie
Copy link
Collaborator

In the medium term:

  1. Render your slides using the Render button or quarto render.
  2. Apply renderthis::to_pdf() to the rendered html: renderthis::to_pdf("slides.html")
  3. The default to_pdf() should work, but note that you cannot enable complex_slides or partial_slides since those are both tightly coupled to xaringan slides.

@giabaio
Copy link
Author

giabaio commented Sep 6, 2022

Thanks, @gadenbuie --- yes: that more or less works (like I said, slightly worse than what was happening for xaringan slides, but that will do!).

@jhelvy
Copy link
Owner

jhelvy commented Sep 29, 2022

This should (hopefully) be resolved now with v0.2.0 now on CRAN.

@giabaio
Copy link
Author

giabaio commented Sep 29, 2022

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?

I think some issues may be quarto-related quirks that don't directly affect xaringan... Happy to help (if I can...).

@gadenbuie
Copy link
Collaborator

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.

@giabaio
Copy link
Author

giabaio commented Oct 1, 2022

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!

@mcanouil
Copy link
Contributor

mcanouil commented Nov 3, 2022

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.

@giabaio
Copy link
Author

giabaio commented Nov 3, 2022

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!

@mcanouil
Copy link
Contributor

mcanouil commented Nov 3, 2022

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()).

@giabaio
Copy link
Author

giabaio commented Nov 4, 2022

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...

@gadenbuie
Copy link
Collaborator

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.

@giabaio
Copy link
Author

giabaio commented Nov 14, 2022

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! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants