rstudio / pagedown

Paginate the HTML Output of R Markdown with CSS for Print
https://pagedown.rbind.io
Other
894 stars 127 forks source link

The tippy package is not working when using `html_paged` output #308

Open Mosk915 opened 1 year ago

Mosk915 commented 1 year ago

I am trying to use the tippy package in the html_paged output, but it's not working. It works fine when using the regular html_document output though. I can see that the tippy javascript library is in the <head> but for some reason it's not working.

This is the Rmd file that doesn't work. Nothing happens when you hover over the button.

---
title: "tippy"
output: 
  pagedown::html_paged:
    toc: false
    self_contained: true
---

<button id="test" type="button">Test</button>

```{r, echo=FALSE}
library(tippy)

tippy_this("test", "Text...")
```

And this is the one that does work. When you hover over the button you see the tooltip. The only difference is the output type in the yaml header.

---
title: "tippy"
output: 
  html_document
---

<button id="test" type="button">Test</button>

```{r, echo=FALSE}
library(tippy)

tippy_this("test", "Text...")
```
cderv commented 1 year ago

pagedown is a R package to help create paginated HTML, often with the aim to be print ready version created from HTML and CSS. This is heavily built on pagedjs library

Paged.js is a free and open-source library that paginates any HTML content to produce beautiful print-ready PDF

it implements CSS Paged Media and other W3C CSS modules.

I am putting back the context here because this is highly possible that a JS library made for interactive website like tippy.js or popper.js is not compatible with CSS paged media or at least with pagedjs library.

So I wouldn't expect this to work.

First think would be to know if pagedjs works with such other library, but I would think they are not. I don't think tippyjs will support CSS Paged Media.

So this is a upstream issue / feature request - we won't do much in pagedown for this. This needs to be asked on Stackoverflow regarding those JS lib interaction or in each respective repository or chat forum (like https://mattermost.coko.foundation/ for paged.js)

Mosk915 commented 1 year ago

I understand. Thank you for providing the explanation and context surrounding the JS libraries.