-
-
Notifications
You must be signed in to change notification settings - Fork 996
Closed
Description
In pandoc_convert(), the output argument is forced after changing the working directory. This is unexpected, not documented, and breaks downlit::downlit_md_path() and perhaps others. PR follows.
input <- tempfile("in", fileext = ".md")
input
#> [1] "/tmp/Rtmpl3bcya/in6d94718e979a.md"
writeLines("# Document", input)
output <- "out.md"
# Breaks
writeLines("bogus", output)
normalizePath(output, mustWork = FALSE)
#> [1] "/tmp/Rtmp9ZZAHN/reprex6bed4897d478/out.md"
rmarkdown::pandoc_convert(input, output = normalizePath(output, mustWork = FALSE), verbose = TRUE)
#> /usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS /tmp/Rtmpl3bcya/in6d94718e979a.md --output out.md
readLines(output)
#> [1] "bogus"
# Works if we compute output outside of call
writeLines("bogus", output)
output <- normalizePath(output, mustWork = FALSE)
rmarkdown::pandoc_convert(input, output = output, verbose = TRUE)
#> /usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS /tmp/Rtmpl3bcya/in6d94718e979a.md --output /tmp/Rtmp9ZZAHN/reprex6bed4897d478/out.md
readLines(output)
#> [1] "Document" "========"Created on 2020-09-03 by the reprex package (v0.3.0)
yihui
Metadata
Metadata
Assignees
Labels
No labels