Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ext argument to md_document #1715

Merged
merged 2 commits into from
Dec 2, 2019
Merged
Show file tree
Hide file tree
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
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.