Skip to content

Commit

Permalink
Use the +smart extension instead of the --smart argument for Pandoc 2…
Browse files Browse the repository at this point in the history
….0 (#1168)

* fix #1120: use the +smart extension instead of the --smart argument for Pandoc 2.0

* add a news entry for #1168 [ci skip]
  • Loading branch information
yihui authored Oct 24, 2017
1 parent abd0319 commit fa23a72
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions R/html_document.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ html_document <- function(toc = FALSE,
# table of contents
args <- c(args, pandoc_toc_args(toc, toc_depth))

md_extensions <- smart_extension(smart, md_extensions)

# toc_float
if (toc && !identical(toc_float, FALSE)) {

Expand Down
3 changes: 2 additions & 1 deletion R/html_document_base.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ html_document_base <- function(smart = TRUE,

args <- c()

pandoc2.0 <- pandoc_version() >= "2.0"
# smart quotes, etc.
if (smart)
if (smart && !pandoc2.0)
args <- c(args, "--smart")

# no email obfuscation
Expand Down
5 changes: 5 additions & 0 deletions R/output_format.R
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ rmarkdown_format <- function(extensions = NULL) {
paste(format, collapse = "")
}

# Add the +smart extension for Pandoc >= 2.0
smart_extension <- function(smart, extension) {
c(extension, if (smart && pandoc_available("2.0")) "+smart")
}

#' Determine the default output format for an R Markdown document
#'
#' Read the YAML metadata (and any common _output.yml file) for the
Expand Down
2 changes: 2 additions & 0 deletions R/slidy_presentation.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ slidy_presentation <- function(incremental = FALSE,
args <- c(args, pandoc_variable_arg("font-size-adjustment",
font_adjustment))

md_extensions <- smart_extension(smart, md_extensions)

# content includes
args <- c(args, includes_to_pandoc_args(includes))

Expand Down
5 changes: 4 additions & 1 deletion R/word_document.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ word_document <- function(toc = FALSE,
args <- c()

# smart quotes, etc.
if (smart)
if (smart && !pandoc_available("2.0")) {
args <- c(args, "--smart")
} else {
md_extensions <- smart_extension(smart, md_extensions)
}

# table of contents
if (pandoc_available("1.14"))
Expand Down
2 changes: 2 additions & 0 deletions inst/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ rmarkdown 1.7 (unreleased)

* `beamer_presentation()` doesn't work when `citation_package != 'none'` (#1161).

* rmarkdown is compatible with Pandoc 2.0 (not released yet) now (#1120).

rmarkdown 1.6
--------------------------------------------------------------------------------

Expand Down

0 comments on commit fa23a72

Please sign in to comment.