Shiny more rMarkdown how handle both templates

Hi Experts,

I'm creating this post because I need your guidance to choose the best options.

I already created a website using rmarkdown like this https://bookdown.org/yihui/rmarkdown/rmarkdown-site.html

name: "my-website"
navbar:
  title: "WebPage"
  left:
    - text: "Home"
      href: index.html
    - text: "MOP"
      href: MOP.html
    - text: "About"
      href: about.html
  right:    
    - icon: fa-bug fa-lg
      href: about.html
    - icon: fa-question fa-lg
      href: MOP.html

> output:
  html_document:
    theme: cerulean
    highlight: textmate

I also created a shiny app.

 title = "APP",theme = shinytheme("cerulean")
  dashboardPage(
                            header,
                            dashboardSidebar(
                                sidebar
                            ),
                            dashboardBody(
                                shinyDashboardThemes(
                                    theme = "blue_gradient"
                                ),
                                tabItems( 
                                 ...

Both are amazing, and they are working separated without any issue. I just have one link in Markdown to shiny app (open a new window).

My goal now is combine both in single website.

1. My first approach was create a new rMarkdown page add shiny as External applications https://bookdown.org/yihui/rmarkdown/shiny-embedded.html#external-applications

Problems:

  • I lose the template of shiny, all settings are very bad

  • Some features like shinyalert are not working

2. My second approach was: instead of using rmarkdown to call shiny, I used shiny to call rmarkdown (abdicate the .yml).

  navbarPage(title = "APP",theme = shinytheme("cerulean"),
               tabPanel("Home",htmlOutput("renderedReport")),
               #tabPanel("Home3",includeHTML("scripts/markdown/Home.html")),
               tabPanel("Tool",
                          dashboardPage(
                            header,
                             ...
     output$renderedReport<-   renderUI({
          includeMarkdown(knitr::knit('scripts/markdown/Home.Rmd'))
    })

If I use tabPanel("Home",htmlOutput("renderedReport")) I lose the theme(cerulean) for markdown, this limit my possibilities create beautiful documents (the best solution that I found until now).

If I use tabPanel("Home3",includeHTML("scripts/markdown/Home.html'")) the same happens like before (like yml) the shiny stay messed up.

I just want a website (each tab does not have any dependencies with the other tabs).
Example:

  • tab 1 (normal markdown page with only text and images)
  • tab 2 (the shiny app)
  • tab 3 (flex_dashboard)
  • tab 4 (normal markdown page with only text and images)

What is the best way to do it without losing the themes?

Ok, I found a workaround, remove manualy the head of markdown.
Leave like this:

 <head>
 </head>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.