Closed mvanrongen closed 2 months ago
Here's how I see this working. Authors have to opt into synchronized panels by adding a .synchronized
class to the panelset. Then, whenever the user selects a panel tab in a synchronized panelset, any other panelsets in the document will switch to the panel tab with the same name as the selected tab. The key being that the panel tab name needs to be identical.
Here's a small example. There are two panelsets, they each have tabs named R
and Python
and they each demonstrate similar code in the respective languages (example from vetiver docs).
.panelset.synchronized[
.panel[.panel-name[R]
```r
library(pins)
model_board <- board_temp(versioned = TRUE)
model_board %>% vetiver_pin_write(v)
]
.panel[.panel-name[Python]
from pins import board_temp
from vetiver import vetiver_pin_write
model_board = board_temp(versioned = True, allow_pickle_read = True)
vetiver_pin_write(model_board, v)
] ]
.panelset.synchronized[ .panel[.panel-name[R]
model_board %>% pin_versions("cars_mpg")
]
.panel[.panel-name[Python]
model_board.pin_versions("cars_mpg")
] ]
Thanks! That sounds like a good approach to me. I was wondering if this has any effect on the compatibility in R Markdown? I use the fenced divs and I don't know if this method translates to that?
It would be helpful if the default [panel-name] could be altered at the page or website level. For example, it would be great if one could create a dropdown box to set the default [panel-name], allowing users to change language-specific code for example.