Embedding a knitted Rmd report in a uiOutput


I'm trying to embed a knitted Rmd report in a uiOutput window of a shiny app. For simplicity, the Rmd Document is:

title: "Rep Rpeort"
theme: yeti
date: "r format(Sys.time(), '%d %B, %Y')"
output: html_document

kable(mtcars[1:10,],caption = "Table Caption")

If I knit this in Rstudio I get the nicely formatted report:

But if in shiny I use the expression:

output$Report <- renderUI({
HTML(markdown::markdownToHTML(knit('Report2.Rmd', quiet = TRUE),fragment.only = TRUE))

what shows up in the UI window is:

Totally unformatted and useless. What am I missing? How can I get my uiOutput to display the same report as I get using knit in RStudio?



One easy way is to knit it and get the html you wish. After that
in the server side :

output$my.document <- renderUI({

and to the ui :


The above solution is good for static reports.