quarto-ext / lightbox

Create lightbox treatments for images in your HTML documents.
https://quarto-ext.github.io/lightbox/
MIT License
76 stars 4 forks source link

Question about group #7

Closed Pierre9344 closed 1 year ago

Pierre9344 commented 2 years ago

Hello,

Is it possible to indicate groups for graph generated by one or multiple r code chunk? The idea would be reproduce the behavior of the 3 lines bellow with an argument similar to '#| lightbox-group: "picture 1"'

![A Lovely Image](mv-1.jpg){group="my-gallery"}
![Another Lovely Image](mv-2.jpg){group="my-gallery"}
![The Last Lovely Image](mv-3.jpg){group="my-gallery"}
dragonstyle commented 2 years ago

That would be pretty nice! Right now, there isn't a great cross language way to add attributes to figure output, but I think if you're using knitr you should be able to use out-extra to do something like (haven't tried it, but worth giving a shot):

#| out-extra: "group='my-gallery'"
setseed13 commented 1 year ago

Thank for the pointer, the following works perfectly for me:

| out.extra: 'group="my-gallery"'

cderv commented 1 year ago

This was solved by #13 and this is now possible.

Example with several plot in a single chunk

---
title: Simple Lightbox Example
filters:
   - lightbox
lightbox: auto
---

```{r}
#| fig-cap: 
#|   - Caption for first plot
#|   - Caption for second plot
#| lightbox: 
#|   group: cars
#|   description: 
#|     - This is the decription for first graph
#|     - This is the decription for second graph
plot(mtcars)
plot(cars)