How to remove Bootstrap css from rmarkdown::run html_document with shiny runtime

37 views Asked by At

I'm trying to make this simple shiny app using html_document and runtime: shiny.

Here is my Rmd:

<!-- 
setwd(dirname(rstudioapi::getSourceEditorContext()$path))
Sys.setenv(RSTUDIO_PANDOC = "C:/Users/xx/scoop/apps/rstudio/current/resources/app/bin/quarto/bin/tools")
rmarkdown::run("test.Rmd", shiny_args = list(port = 5050, host = "0.0.0.0", launch.browser = F))
 -->

---
title: "xxx"
output:
  html_document:
    theme: null
runtime: shiny
---

test

and I run this .Rmd file with

rmarkdown::run("test.Rmd", shiny_args = list(port = 5050, host = "0.0.0.0", launch.browser = F))

And when I inspect the elements of that page I can see bootstrap.min.css which I would like to remove completely to be able to use only my own:

enter image description here

I have tried:

  • setting theme: null
  • setting the custom css in yaml css: https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.4/css/bulma.min.css
  • this answer only works for shiny apps that have a defined ui
  • I looked in all the rmarkdown::run doc parameters
1

There are 1 answers

0
Stéphane Laurent On

Use the render_args argument:

rmarkdown::run(
  "test.Rmd", default_file = "test.Rmd", 
  shiny_args = list(
    port = 5050, host = "0.0.0.0", launch.browser = TRUE
  ), 
  render_args = list(
    output_format = rmarkdown::html_document(theme = NULL)
  )
)