Skip to content

Commit

Permalink
another sentinel to avoid processing other types of files (only proce…
Browse files Browse the repository at this point in the history
…ss .md/.markdown files)
  • Loading branch information
yihui committed Jan 17, 2024
1 parent 6ee9c07 commit dfc4775
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: rmarkdown
Title: Dynamic Documents for R
Version: 2.25.2
Version: 2.25.3
Authors@R: c(
person("JJ", "Allaire", , "[email protected]", role = "aut"),
person("Yihui", "Xie", , "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-0645-5666")),
Expand Down
5 changes: 5 additions & 0 deletions R/html_document_base.R
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ html_document_base <- function(theme = NULL,
}

extract_preserve_chunks <- function(input_file, extract = extractPreserveChunks) {
# Don't try to modify the input file if it's not .md, otherwise the original
# input could be corrupted (#2534). In theory, preserved chunks should only
# exist in the intermediate .md file from knit(). If the .md file is not
# intermediate but original, this processing should be harmless.
if (!xfun::file_ext(input_file) %in% c('md', 'markdown')) return()
input_str <- one_string(read_utf8(input_file))
preserve <- extract(input_str)
if (!identical(preserve$value, input_str)) write_utf8(preserve$value, input_file)
Expand Down

0 comments on commit dfc4775

Please sign in to comment.