@@ -182,25 +182,19 @@ reprex_render_impl <- function(input,
182182 invisible (reprex_file )
183183}
184184
185- # heavily influenced by the post_processor() function of github_document()
185+ # influenced by the post_processor() function of github_document()
186+ # but with substantial reprex-specific updates in 2024-09
186187preview <- function (input ) {
187- css <- rmarkdown :: pandoc_path_arg(
188+ mode <- if (is_dark_mode()) " dark" else " light"
189+ res_dir <- rmarkdown :: pandoc_path_arg(
188190 path_package(
189- " rmarkdown" ,
190- " rmarkdown/templates/github_document/resources/github.css"
191- )
192- )
193- css <- glue(" github-markdown-css:{css}" )
194- template <- rmarkdown :: pandoc_path_arg(
195- path_package(
196- " rmarkdown" ,
197- " rmarkdown/templates/github_document/resources/preview.html"
191+ " reprex" ,
192+ glue(" rmarkdown/templates/reprex_document/resources" )
198193 )
199194 )
200195 args <- c(
201- " --standalone" , " --self-contained" ,
202- " --template" , template ,
203- " --variable" , css ,
196+ " --standalone" , " --embed-resources" ,
197+ " --css" , path(res_dir , glue(" github-{mode}.css" )),
204198 " --metadata" , " pagetitle=PREVIEW" ,
205199 " --quiet"
206200 )
@@ -216,7 +210,7 @@ preview <- function(input) {
216210 preview_file <- preview_file(input )
217211 rmarkdown :: pandoc_convert(
218212 input = input , to = " html" , from = " gfm" , output = preview_file ,
219- options = args , verbose = FALSE
213+ options = args , verbose = TRUE
220214 )
221215
222216 # can be interesting re: detecting how we were called and what we should
0 commit comments