gadenbuie / xaringanExtra

:ferris_wheel: A playground of enhancements and extensions for xaringan slides.
https://pkg.garrickadenbuie.com/xaringanExtra
Other
445 stars 36 forks source link

Panelset titles are rendered as "Panel" in my blogdown website #170

Closed uriahf closed 2 months ago

uriahf commented 2 years ago

I'm using panelset in my blogdown website, I can't understand why but it is rendered as "Panel" instead of the original titles.

direct link: https://rtichoke-blog.netlify.app/blog/2022-06-06-cox-box-transformation/?panelset=panel

code: ### Creating ROC Curve with {rtichoke} {.panelset}

panelset

gadenbuie commented 2 years ago

Thanks @uriahf. To dig into this further it'd be very helpful to have your system info. Can you share the output of

devtools::session_info(c("rmarkdown", "knitr", "blogdown", "xaringanExtra"))
blogdown::hugo_version()
uriahf commented 2 years ago

This is the output I get:

devtools::session_info(c("rmarkdown", "knitr", "blogdown", "xaringanExtra"))
#> - Session info ---------------------------------------------------------------
#>  setting  value
#>  version  R version 4.1.3 (2022-03-10)
#>  os       Windows 10 x64 (build 17134)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  Hebrew_Israel.1255
#>  ctype    Hebrew_Israel.1255
#>  tz       Asia/Jerusalem
#>  date     2022-06-14
#>  pandoc   2.17.1.1 @ C:/Program Files/RStudio/bin/quarto/bin/ (via rmarkdown)
#> 
#> - Packages -------------------------------------------------------------------
#>  package       * version date (UTC) lib source
#>  base64enc       0.1-3   2015-07-28 [1] CRAN (R 4.1.1)
#>  blogdown        1.8     2022-02-16 [1] CRAN (R 4.1.3)
#>  bookdown        0.25    2022-03-16 [1] CRAN (R 4.1.3)
#>  bslib           0.3.1   2021-10-06 [1] CRAN (R 4.1.3)
#>  digest          0.6.29  2021-12-01 [1] CRAN (R 4.1.3)
#>  evaluate        0.15    2022-02-18 [1] CRAN (R 4.1.3)
#>  fastmap         1.1.0   2021-01-25 [1] CRAN (R 4.1.3)
#>  fs              1.5.2   2021-12-08 [1] CRAN (R 4.1.3)
#>  glue            1.6.2   2022-02-24 [1] CRAN (R 4.1.3)
#>  highr           0.9     2021-04-16 [1] CRAN (R 4.1.3)
#>  htmltools       0.5.2   2021-08-25 [1] CRAN (R 4.1.3)
#>  httpuv          1.6.5   2022-01-05 [1] CRAN (R 4.1.3)
#>  jquerylib       0.1.4   2021-04-26 [1] CRAN (R 4.1.3)
#>  jsonlite        1.8.0   2022-02-22 [1] CRAN (R 4.1.3)
#>  knitr           1.37    2021-12-16 [1] CRAN (R 4.1.3)
#>  later           1.3.0   2021-08-18 [1] CRAN (R 4.1.3)
#>  magrittr        2.0.2   2022-01-26 [1] CRAN (R 4.1.3)
#>  mime            0.12    2021-09-28 [1] CRAN (R 4.1.1)
#>  promises        1.2.0.1 2021-02-11 [1] CRAN (R 4.1.3)
#>  R6              2.5.1   2021-08-19 [1] CRAN (R 4.1.3)
#>  rappdirs        0.3.3   2021-01-31 [1] CRAN (R 4.1.3)
#>  Rcpp            1.0.8.3 2022-03-17 [1] CRAN (R 4.1.3)
#>  rlang           1.0.2   2022-03-04 [1] CRAN (R 4.1.3)
#>  rmarkdown       2.13    2022-03-10 [1] CRAN (R 4.1.3)
#>  sass            0.4.0   2021-05-12 [1] CRAN (R 4.1.3)
#>  servr           0.24    2021-11-16 [1] CRAN (R 4.1.3)
#>  stringi         1.7.6   2021-11-29 [1] CRAN (R 4.1.2)
#>  stringr         1.4.0   2019-02-10 [1] CRAN (R 4.1.3)
#>  tinytex         0.37    2022-02-16 [1] CRAN (R 4.1.3)
#>  uuid            1.0-4   2022-03-16 [1] CRAN (R 4.1.3)
#>  xaringanExtra   0.6.0   2022-06-07 [1] CRAN (R 4.1.3)
#>  xfun            0.30    2022-03-02 [1] CRAN (R 4.1.3)
#>  yaml            2.3.5   2022-02-21 [1] CRAN (R 4.1.2)
#> 
#>  [1] C:/Program Files/R/R-4.1.3/library
#> 
#> ------------------------------------------------------------------------------
blogdown::hugo_version()
#> [1] '0.95.0'

Created on 2022-06-14 by the reprex package (v2.0.1)

gadenbuie commented 2 years ago

In general, if you're using hugo apéro, you should follow the syntax listed in the apéro documentation.

That said, syntax like the following should be supported (at least I thought it was supported)

# Panelset In R Markdown! {.panelset}

## Tab One

Amet enim aptent molestie vulputate pharetra
vulputate primis et vivamus semper.

## Tab Two

Sit etiam malesuada arcu fusce ullamcorper
interdum proin tincidunt curabitur felis?

I think that recent changes in bookdown to suppress the header-attrs.js script in bookdown::html_document2(), the function behind blogdown::html_page(), has changed where I should look for specific classes. I was counting on header-attrs.js making things consistent, but that's no longer the case.

Edit: or maybe not, since suppressing header-attrs.js happens in bookdown because the same attributes are already moved around by an internal function.

uriahf commented 2 years ago

I tried to change to HTML Tags, but it is still not working: Maybe the output will help you realize what's going on:

panelset

Notice that a part of the HTML is displayed even though it shouldn't be.

Direct Link: https://rtichoke-blog.netlify.app/blog/2022-06-06-cox-box-transformation/

Code: https://github.com/uriahf/rtichoke_hugo/commit/a0c71e2a29fb0a37e4c874f4bb0607e46267709f#diff-9f8ed708f147992e9ce9ecebb7c877179b405f3fb45e56b6adcf7b35fea06876

gadenbuie commented 2 years ago

You're missing a few closing </div> tags and you have an extra <div class="panelset">. Also, because you have markdown content inside the <div>s you'll probably need to remove indentation for all of the <div> tags.

Here's the pattern again:

<div class="panelset">
<div class="panel">
<div class="panel-name">Question</div>

<!-- R chunk in panel -->

</div>
<div class="panel">
<div class="panel-name">Answer 🐣</div>

<!-- R chunk in panel -->

</div>
</div>

Also you can try using the shortcode syntax mentioned in the hugo apero docs.

gadenbuie commented 2 years ago

Here's a reprex for the lower level format, but panelset works in each of the output formats below so I haven't been able to reprex the problem (at this level).

---
title: Issue 170
subtitle: https://github.com/gadenbuie/xaringanExtra/issues/170
output:
  bookdown::html_document2: default
  blogdown::html_page: default
  rmarkdown::html_document: 
    self_contained: false
---

```{r setup, echo = FALSE}
xaringanExtra::use_panelset(FALSE)

Panelset In R Markdown! {.panelset}

Tab One

Amet enim aptent molestie vulputate pharetra vulputate primis et vivamus semper.

Tab Two

Sit etiam malesuada arcu fusce ullamcorper interdum proin tincidunt curabitur felis?

uriahf commented 2 years ago

Thanks! Still the same problem also with the reprex:

image

Direct link: http://localhost:4321/blog/2022-06-23-issue-70/?panelset=panel

Code: https://github.com/uriahf/rtichoke_hugo/commit/012e5cf618e024684768bf14ca77c0068886f202

gadenbuie commented 2 years ago

Sorry, I should have been more clear. The reprex is for me in investigating this issue. Have you tried the suggestions the comment above that? https://github.com/gadenbuie/xaringanExtra/issues/170#issuecomment-1164408424

uriahf commented 2 years ago

I've tried now, I wanted to post the reprex before sorting the div tags just in case that something will pop up.

https://github.com/uriahf/rtichoke_hugo/commit/052b74fdc53b7634d1f2d70401f9260ee6414ba9#diff-9f8ed708f147992e9ce9ecebb7c877179b405f3fb45e56b6adcf7b35fea06876