Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature request: Synchronized panelsets #175

Closed
mvanrongen opened this issue Jul 8, 2022 · 3 comments
Closed

Feature request: Synchronized panelsets #175

mvanrongen opened this issue Jul 8, 2022 · 3 comments

Comments

@mvanrongen
Copy link

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.

@gadenbuie gadenbuie changed the title Feature request: dynamically changing the default [panel-name] Feature request: Synchronized panelsets Jul 8, 2022
@gadenbuie
Copy link
Owner

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]

```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]

```r
model_board %>% pin_versions("cars_mpg")
```

]

.panel[.panel-name[Python]

```python
model_board.pin_versions("cars_mpg")
```

]
]

@mvanrongen
Copy link
Author

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?

@gadenbuie gadenbuie added this to the 0.8.0 milestone Nov 29, 2023
@gadenbuie
Copy link
Owner

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants