Skip to content

Commit

Permalink
only add gfm_auto_identifier for Pandoc 2.0+
Browse files Browse the repository at this point in the history
Before that `markdown_github` is used and it can't be added to it
  • Loading branch information
cderv committed Aug 29, 2023
1 parent 0200cc3 commit ea9c7c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/github_document.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@ github_document <- function(toc = FALSE,
if (!hard_line_breaks) variant <- paste0(variant, "-hard_line_breaks")

# atx headers are the default in pandoc 2.11.2 and the flag has been deprecated
# to be replace by `--markdown-headings=atx|setx`
# to be replaced by `--markdown-headings=atx|setx`
if (!pandoc_available("2.11.2")) pandoc_args <- c(
"--atx-headers", pandoc_args
)

if ((toc || number_sections) && !isTRUE(grepl("gfm_auto_identifiers", md_extensions))) {
if ((toc || number_sections) &&
!isTRUE(grepl("gfm_auto_identifiers", md_extensions)) &&
pandoc2) {
md_extensions <- c(md_extensions, "+gfm_auto_identifiers")
}

Expand Down

0 comments on commit ea9c7c9

Please sign in to comment.