gadenbuie / xaringanExtra

:ferris_wheel: A playground of enhancements and extensions for xaringan slides.
https://pkg.garrickadenbuie.com/xaringanExtra
Other
445 stars 36 forks source link

Content of panels not displayed when using .panelset in bookdown #183

Closed Dr-Junior closed 2 months ago

Dr-Junior commented 1 year ago

Hi,

I'm trying to use panelset in bookdown. I have followed the instructions given here: https://pkg.garrickadenbuie.com/xaringanExtra/panelset//rmarkdown.html

To give an example, I'll use the Minimal book example from bookdown:

image

When I build the book, I get tabs for the panels but they do not contain any text (please see image below). I have tried including images and/or results from code chunks, nothing is displayed. I have also tried using Non-standard Rmd. I have tried browsers Chrome and Edge.

image

I have updated R, R studio and all packages.

image image

I hope this can be resolved, thank you for a great package!

gadenbuie commented 1 year ago

Hi! Sorry you've run into issues with panelset! Can you provide a minimal example, either in a repo or by copy-pasting the contents of that Rmd into this issue?

Dr-Junior commented 1 year ago

Thanks for the reply, yeah sure, sorry I didn't include it in the original post.

The repo is here: https://github.com/Dr-Junior/panelset_problem.git

When I knit or build the "index.rmd" I get the results described above.

Of note, everything works as it should with .panelset when a start a regular R project (i.e. not a bookdown project) and copy/paste the code of "index.rmd" (without the YAML header) to an .rmd file and knit it. So the error seems to be related to bookdown.

gilesknight commented 1 year ago

@Dr-Junior I've hit this problem before and it's to do with bookdown's CSS. Try adding this to your book's style.css:

.panelset .panel-active {
display: block !important;
}
Dr-Junior commented 1 year ago

@gilesnknight That worked!! My eternal thanks!

gadenbuie commented 1 year ago

I reopened this to remind myself to take a look and see if there's a general solution that would work for bookdown and all other Rmd output formats.

gadenbuie commented 1 year ago

Thank you @Dr-Junior for the report and @gilesnknight for the solution!

Dr-Junior commented 1 year ago

Not sure if I should start a new issue but with the solution provided by @gilesnknight now the TOC links for the subheadings that contain a panelset section don't work. When I click a subheading (that contains a panelset section) in the TOC, it takes me to the main chapter but not the subheading. I don't suppose there is a simple solution for this as well?