Skip to content

Commit

Permalink
add ext argument to md_document (#1715)
Browse files Browse the repository at this point in the history
  • Loading branch information
atusy authored and yihui committed Dec 2, 2019
1 parent 682ab7e commit f6961af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ rmarkdown 1.19

- `render_site()` can render R scripts in addition to Rmd files if you set `autospin: true` in `_site.yml` (thanks, @zeehio, #1564).

- Added `ext` argument to `md_document()`. Its default value is ".md". This argument is intended to be used together with `variant` argument (e.g., `variant = "context"` and `ext = ".pdf"`) (thanks, @atusy, #1715).

rmarkdown 1.18
================================================================================
Expand Down
6 changes: 4 additions & 2 deletions R/md_document.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#' widely used retina displays, but will also result in the output of
#' \code{<img>} tags rather than markdown images due to the need to set the
#' width of the image explicitly.
#' @param ext Extention of the output document (defaults to ".md").
#' @return R Markdown output format to pass to \code{\link{render}}
#' @examples
#' \dontrun{
Expand All @@ -43,7 +44,8 @@ md_document <- function(variant = "markdown_strict",
df_print = "default",
includes = NULL,
md_extensions = NULL,
pandoc_args = NULL) {
pandoc_args = NULL,
ext = ".md") {

# base pandoc options for all markdown output
args <- c(if (variant != "markdown" || preserve_yaml) "--standalone")
Expand Down Expand Up @@ -76,7 +78,7 @@ md_document <- function(variant = "markdown_strict",
pandoc = pandoc_options(to = variant,
from = from_rmarkdown(extensions = md_extensions),
args = args,
ext = '.md'),
ext = ext),
clean_supporting = FALSE,
df_print = df_print,
post_processor = post_processor
Expand Down
5 changes: 4 additions & 1 deletion man/md_document.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f6961af

Please sign in to comment.