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

xaringanExtra::use_panelset() does not respect layout argument in distill_article #76

Closed ColinConwell closed 3 years ago

ColinConwell commented 3 years ago

use_panelset() works beautifully in distill_articles, except that at the moment they don't seem to respect wider layouts for figures and the like (e.g. layout='l-screen-inset'). is there a workaround for this?

gadenbuie commented 3 years ago

I'm inclined to think that a workaround exists, but there's also a chance that something very distill specific is at play here. If you could share a reprex it would greatly increase the chances that I would tinker with it and find a solution.

ColinConwell commented 3 years ago

Thanks for the response! I'm not entirely sure the right way to copy and paste this over, but here's the reproducible example:

---
title: 'Xaringan Panels in Distill'
output:
  distill::distill_article:
    self_contained: true
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)

Photo Credit: the beautiful Hypocalypse distill page: https://hypocolypse.github.io/

Ideally, these panels (or at least the images within them) will extend across the page (set in distill with layout='l-page').

xaringanExtra::use_panelset()

::::: {.panelset}

::: {.panel}

PANEL 1 {.panel-name}

knitr::include_graphics('https://hypocolypse.github.io/assets/banner.png')

:::

::: {.panel}

PANEL 2 {.panel-name}

knitr::include_graphics('https://hypocolypse.github.io/assets/banner.png')

:::

::: {.panel}

PANEL 3 {.panel-name}

knitr::include_graphics('https://hypocolypse.github.io/assets/banner.png')

:::

:::::

jhelvy commented 3 years ago

Quick fix for this is to wrap the whole panelset in a div with the desired class, like l-page or l-body-outset

To do this, you can use the ::: notation to create a div. I just tried this with the example above and it worked:

:::l-page

::::: {.panelset}

::: {.panel}

#### PANEL 1 {.panel-name}
```{r, layout='l-page'}
knitr::include_graphics('https://hypocolypse.github.io/assets/banner.png')

:::

::: {.panel}

PANEL 2 {.panel-name}

knitr::include_graphics('https://hypocolypse.github.io/assets/banner.png')

:::

::: {.panel}

PANEL 3 {.panel-name}

knitr::include_graphics('https://hypocolypse.github.io/assets/banner.png')

:::

:::::

:::

ColinConwell commented 3 years ago

thanks, @jhelvy -- phenomenal fix. I reckon we can close this for now.

gadenbuie commented 3 years ago

Awesome, thanks again @jhelvy!