Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/resources/rmd/execute.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ execute <- function(input, format, tempDir, libDir, dependencies, cwd, params, r
# rmd input filename
rmd_input <- paste0(xfun::sans_ext(input), ".rmarkdown")

# swap out the input
write(markdown, rmd_input)
# swap out the input by reading then writing content.
# This handles `\r\n` EOL on windows in `markdown` string
# by spliting in lines
xfun::write_utf8(
xfun::read_utf8(textConnection(markdown, encoding = "UTF-8")),
rmd_input
)
input <- rmd_input

# remove the rmd input on exit
Expand Down