DT (htmlwidgets content) for conflr

Viewed 69

Any recommendations for rendering tables serverless with {rmarkdown}? I need to do this so I can push the rendered HTML to a Confluence page with the help of {conflr}.

When I render something like the below in an RMD file and then try to send to Confluence using conflr:::confl_create_post_from_Rmd_addin(), I get this error:

output file: serverless_test.knit.md

Error: Functions that produce HTML output found in document targeting commonmark-yaml_metadata_block output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:

  always_allow_html: true

Note however that the HTML output will not be visible in non-HTML formats.

After adding the suggested flag, the table still does not render.

If I try to run it locally without pushing to Confluence using DT:renderDT(..., server = FALSE), I get a warning This R Markdown document contains Shiny content, but was rendered to a static file. Shiny content in the document may not appear, and will not be interactive. In addition, the filter = "top" renders the text box at top of each column to filter column contents, but when you enter text nothing happens.

---
title: "serverless_dt"
author: "Matt Wood"
date: "2022-08-17"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo=TRUE)
library(tidyverse)
library(DT)
```

```{r}
DT::datatable(iris) 
# %>% DT::renderDT(server = FALSE)
```

conflr:::confl_create_post_from_Rmd_addin()

Thanks for any help!

1 Answers

The problem is that DataTables(DT) library is a htmlwidgets thing which isn't supported by conflr.

You can use only static content with the chunk option screenshot.force = TRUE

Related