Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

unable to use tabset id as selector #88

Open
zac-garland opened this issue Oct 8, 2019 · 0 comments
Open

unable to use tabset id as selector #88

zac-garland opened this issue Oct 8, 2019 · 0 comments

Comments

@zac-garland
Copy link

Hi Winston

if we start off with the base Rmd template and create a tabset

## {.tabset .tabset-fade}

### R Markdown
plot

### Including Plots
other plot

and render to test_tabset.html

it produces two id's #r-markdown & #including-plots

when i try to use these as selectors, I am unable to screenshot the content of any tab other than the first.

is this an issue with how Rmarkdown defines tabs or webshot? I'm aware that you can't navigate to the tabs like a normal html page, e.g. test_tabset.html#including-plots won't take you to the second tab, and I'm wondering if that is the reason. Do you know of any workaround?

# location of html doc
f_path <- here("inst","test_tabset.html")

# find level 3 tabs and convert to selectors
pg_screen <- read_html(f_path) %>%
  html_nodes(".level3") %>%
  html_attr("id") %>% 
  paste0("#",.)

# create file paths
f_paths <- paste0(snakecase::to_snake_case(pg_screen),".png")

# screenshot
webshot(f_path,
        file = f_paths,
        selector = list(pg_screen))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant