Skip to content

Commit f6961af

Browse files
atusyyihui
authored andcommitted
add ext argument to md_document (#1715)
1 parent 682ab7e commit f6961af

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ rmarkdown 1.19
99

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

12+
- 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).
1213

1314
rmarkdown 1.18
1415
================================================================================

R/md_document.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#' widely used retina displays, but will also result in the output of
2323
#' \code{<img>} tags rather than markdown images due to the need to set the
2424
#' width of the image explicitly.
25+
#' @param ext Extention of the output document (defaults to ".md").
2526
#' @return R Markdown output format to pass to \code{\link{render}}
2627
#' @examples
2728
#' \dontrun{
@@ -43,7 +44,8 @@ md_document <- function(variant = "markdown_strict",
4344
df_print = "default",
4445
includes = NULL,
4546
md_extensions = NULL,
46-
pandoc_args = NULL) {
47+
pandoc_args = NULL,
48+
ext = ".md") {
4749

4850
# base pandoc options for all markdown output
4951
args <- c(if (variant != "markdown" || preserve_yaml) "--standalone")
@@ -76,7 +78,7 @@ md_document <- function(variant = "markdown_strict",
7678
pandoc = pandoc_options(to = variant,
7779
from = from_rmarkdown(extensions = md_extensions),
7880
args = args,
79-
ext = '.md'),
81+
ext = ext),
8082
clean_supporting = FALSE,
8183
df_print = df_print,
8284
post_processor = post_processor

man/md_document.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)