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

Option to hide/ignore incremental slides #192

Closed
sebpardo opened this issue Feb 6, 2019 · 9 comments
Closed

Option to hide/ignore incremental slides #192

sebpardo opened this issue Feb 6, 2019 · 9 comments
Milestone

Comments

@sebpardo
Copy link

sebpardo commented Feb 6, 2019

There does not seem to be an option in remark to ignore incremental slides separators when converting to html. This is particularly desirable when converting html to pdf to produce slide notes. While there is already a request for this feature in the remark repo (gnab/remark#478), I think this could be easily implemented in xaringan by parsing the Rmd file to remove the -- delimiters before moon_readering to a temporary html, and finally converting to pdf using decktape. I use something along these lines in a Makefile using sed:

sed '/^--$$/d' slides.Rmd > temp.Rmd 
Rscript -e "library(rmarkdown); render('temp.Rmd', 'xaringan::moon_reader')"
decktape remark --chrome-arg=--allow-file-access-from-files temp.html slides.pdf

Perhaps this could be easily implemented in xaringan/R using a text parser?

@yihui
Copy link
Owner

yihui commented Feb 7, 2019

I think @benjie's solution there is more robust and also has the advantage of letting you both view and print the slides with the same HTML page, so I'll integrate it into this package. Of course, I wish remark.js could support it officially.

The problem with sed '/^--$$/d' is that not all -- mean separators, e.g., -- in a code block:

```
--
```

I actually want this feature myself, too, so thanks for the report!

@yihui yihui added this to the v0.9 milestone Feb 7, 2019
@yihui yihui closed this as completed in 8a13af5 Feb 7, 2019
@yihui
Copy link
Owner

yihui commented Feb 7, 2019

Done. You may test https://slides.yihui.name/xaringan/.

remotes::install_github('yihui/xaringan')

@sebpardo
Copy link
Author

sebpardo commented Feb 7, 2019

The slides print to pdf without the incremental slides as expected when using the Chromium -> print to PDF method, but unfortunately this method still has many issues which have previously been reported (e.g. not showing italics/bold text, LaTeX math, etc.). As is to be expected, the decktape method is unchanged.

I have minimal knowledge of CSS and JS, so perhaps what I'm going to suggest won't make much sense, but I'll give it a shot anyways :-) Looking at the hack written by @benjie it seems there should be a way of adding a CSS theme to enable hiding incremental slides when moon reading. Could adding has-continuation to all incremental slides but the last be done automatically, but the @media print { .has-continuation { display: none; } } trigger also be delivered via a CSS theme that can be specified in the Rmd's YAML for rendering to html rather than printing? This way we could potentially adapt this method for converting to pdf using decktape, with works much better than Chromium for complex slides.

@yihui
Copy link
Owner

yihui commented Feb 7, 2019

I'm not sure if I get it: are you saying the fix doesn't work for decktape?

BTW, I have just fixed the several issues related to Chrome printing (MathJax, italics/bold text, ...). I think Chrome should work reasonably well with the current development version of xaringan.

@sebpardo
Copy link
Author

sebpardo commented Feb 8, 2019

Yes, sorry about that. Converting to pdf with decktape() still results in separate pages for incremental slides when docker = FALSE. I don't have docker installed so I'm unable to try to convert through it.

That's great about the fixes related to Chrome printing! Will test things again with the latest dev version. Thanks again!

@yihui
Copy link
Owner

yihui commented Feb 8, 2019

I see. It is unfortunate that decktape does not respect display: none in this case. As I said, simply deleting ^--$ from the Markdown source is not a robust solution, so I tend not to use it if possible.

@pat-s
Copy link
Collaborator

pat-s commented Feb 8, 2019

Which decktape version did you use? I can give it a shot later.

@sebpardo
Copy link
Author

sebpardo commented Feb 8, 2019

@pat-s I used decktape v2.9.1.

@yihui
Copy link
Owner

yihui commented Feb 15, 2019

In fact, in the development version of remark.js, there is an option to disable incremental slides entirely: gnab/remark@40e69d21580

And a CSS class remark-slide-incremental will also be added: gnab/remark@29515556

That said, I have no idea when the next version of remark.js will be released: gnab/remark#548 (comment).

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

3 participants