Closed sylvaine31 closed 1 month ago
👋 @sylvaine31
First, advice on formatting: Use one more backtick to wrap you rmd source. See https://yihui.org/issue/#please-format-your-issue-correctly
Then, advice on reprex: With newer R, use |>
and not %>%
which allows in reprex to avoid having to laod magrittr (which is missing in our example here).
Regarding the issue, it seems there are some changes in flextable that requires some adaptation in pagedown.
Using flextable 0.8.5, it works but then starting from 0.8.6 it fails with table not showing.
So I need to check with @davidgohel what are the changes between these version. Repo has not tagged version so not easy to compare the change, but I'll do a bit of archeology.
Thanks for CRAN snapshot github repo, we can access the difference in the version
Not the commit history, but it could give us some hint still
It could be related to tabwid.js
addition which may not run correctly with paged.js applying 🤔
Possibly related to previous problem
where the fix does not work anymore
And this search lead me to this commit
I think that flextable now always output shadow dom, and #216 still applies because the ft.shadow
option is not existing anymore in flextable (https://github.com/davidgohel/flextable/commit/439d93c55339b0d1ff7929fbfa80d470adf75308#diff-f0c168982bc3b1afb5f98bd5e0230be9a96126d723db777bfde5b3dfeacf9b00L1012)
@davidgohel I'll see what I can do in pagedown but if there is a way to still not use shadow dom in paged.js context, it would be cool.
Otherwise, it will need to wait for an update in Paged.js inside pagedown but I am not sure that paged.js really support shadow dom
So we may be blocked here. 🤔
Hi @cderv
Is there a way to detect with knitr (or any option) that the format is pagedown? Something like knitr::is_html_output()
?
Is there a way to detect with knitr (or any option) that the format is pagedown? Something like knitr::is_html_output()?
I don't think there is yet a straightforward way. 🤔
@yihui just to confirm: Do we have a way in knitr to know which rmarkdkown format as triggered the render ?
We don't, but we can set a flag similar to https://github.com/rstudio/pagedown/blob/410def190672fb3f854be7f89ac0200d80b79ec6/R/paged.R#L176-L178
I feel the flag should be set in opts_knit
instead of opts_chunk
since it's global to the document instead of individual chunks.
With that flag (say, named is.paged.js
), flextable can detect knitr::opts_knit$get('is.pagedjs')
.
that would be great, I could read knitr::opts_knit$get('is.pagedjs')
in flextable and you could remove that fmt$knitr$opts_chunk[['ft.shadow']] = FALSE
in pagedown
@davidgohel you can try out https://github.com/rstudio/pagedown/pull/333
I have kept fmt$knitr$opts_chunk[['ft.shadow']] = FALSE
for backward compatibility with older flextable
@sylvaine31 the fix has been applied in 'flextable', you should be able to display flextables again with dev version of 'pagedown' and dev version of flextable.
Hi, I'm not sure wheter it is a flextable or a pagedown issue. When using equations in a pagedown::html_paged Rmd, flextable does not render. my reprex :
mtcars with print renders
the equation
$$ Y = \frac{a_{x}-b} {c} $$