gadenbuie / xaringanExtra

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

[panelset] with bookdown gitbook #108

Closed konstruktur closed 3 years ago

konstruktur commented 3 years ago

Hi Garrick,

thanks so much for xaringanExtra! From all these amazing features I'd like to use panelset in a bookdown project. Tabsets are not native in bookdown, because of the focus on portability between formats (s. https://github.com/rstudio/bookdown/issues/393). However in a recent question xaringanExtra's panelset was found as a solution to integrate tabs in bookdown: https://stackoverflow.com/a/65921791/3680150

It seems that the panelset works correctly in

bookdown::html_book() (with option split_by: chapter) grafik

bookdown::html_document2() grafik

but in my preferred format gitbook the content of the panels does not yet appear

bookdown::gitbook() grafik

Do you see a reason for that?

I use R 4.0.4 xaringanExtra 0.4.0 bookdown 0.21.4 knitr 1.3.2

Thanks a lot and all the best, G

gadenbuie commented 3 years ago

I'm not very familiar with bookdown::gitbook() but if you post a more complete minimal reproducible example where panelset doesn't work as expected, there's a much higher likelihood that I'll be curious and try to figure out why.

konstruktur commented 3 years ago

Hi Garrick,

sorry I prepared a reprex, but forgot to post it. Here it comes - it's a default bookdown project where I added 00a-panelset.Rmd and 00b-panelset.Rmd with examples for panelset and added two output format (html_document2 and html_book) to _output.yml. Please check whether this is of use for you - I'll be happy to send you more examples (hopefully reproducible :-)

Thanks a lot, G

bookdownpanelset.zip

konstruktur commented 3 years ago

The panel content is there, but not rendered visible - seems like a CSS issue. The CSS for .panelset .panel-active interferes with .book

grafik

If we add !important for a quick fix the content becomes visible. I'll have to check whether this has undesirable consequences.

grafik

konstruktur commented 3 years ago

Hi Garrick,

I added !important to the stylesheet (style.css) and it works - the panel content shows when active, just as it should.

.panelset .panel-active {
    display: block !important;
}

I do not know whether hardcoding this is the best way, but at least it's a simple one. Sorry for bothering you with this, I could have found out earlier. Thanks a lot for your work on xaringanExtra! Best, G