diff --git a/NEWS.md b/NEWS.md index 63444403f..5f4cdff3d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # usethis (development version) +* `create_package()` now turns markdown processing for roxygen2 on by default + (#911). + * `edit_file()` and `use_test()` gain an `open` parameter that allows you to control whether or not the function is opened for editing by the user (#817). diff --git a/R/description.R b/R/description.R index 3fac82c5e..9336e8a51 100644 --- a/R/description.R +++ b/R/description.R @@ -78,7 +78,8 @@ use_description_defaults <- function() { "Authors@R" = 'person("First", "Last", , "first.last@example.com", c("aut", "cre"), comment = c(ORCID = "YOUR-ORCID-ID"))', License = " `use_mit_license()`, `use_gpl3_license()` or friends to pick a license", Encoding = "UTF-8", - LazyData = "true" + LazyData = "true", + Roxygen = "list(markdown = TRUE)" ) ) } diff --git a/R/roxygen.R b/R/roxygen.R index 6f9d88caa..e78e22c66 100644 --- a/R/roxygen.R +++ b/R/roxygen.R @@ -1,10 +1,9 @@ #' Use roxygen with markdown #' -#' You'll need to manually re-document once enabled. If you are already using -#' roxygen2, but not with markdown, the -#' [roxygen2md](https://roxygen2md.r-lib.org) package will be used to -#' convert many Rd expressions to markdown. The package uses heuristics, so -#' you'll need to check the results. +#' If you are already using roxygen2, but not with markdown, you'll need to use +#' [roxygen2md](https://roxygen2md.r-lib.org) to convert existing Rd +#' expressions to markdown. The conversion is not perfect, so make sure +#' to check the results. #' #' @export use_roxygen_md <- function() { @@ -17,15 +16,13 @@ use_roxygen_md <- function() { use_description_field("RoxygenNote", roxy_ver) ui_todo("Run {ui_code('devtools::document()')}") } else if (!uses_roxygen_md()) { - check_installed("roxygen2md") + use_description_field("Roxygen", "list(markdown = TRUE)") + if (!uses_git()) { ui_todo("Use git to ensure that you don't lose any data") } ui_todo( - " - Refer to {ui_code('roxygen2md::roxygen2md()')} to use markdown markup \\ - with roxygen2. - " + "Run {ui_code('roxygen2md::roxygen2md()')} to convert existing Rd markdown to RMarkdown" ) ui_todo("Run {ui_code('devtools::document()')} when you're done.") } diff --git a/man/use_roxygen_md.Rd b/man/use_roxygen_md.Rd index 3ce78872a..a7caed21d 100644 --- a/man/use_roxygen_md.Rd +++ b/man/use_roxygen_md.Rd @@ -7,9 +7,8 @@ use_roxygen_md() } \description{ -You'll need to manually re-document once enabled. If you are already using -roxygen2, but not with markdown, the -\href{https://roxygen2md.r-lib.org}{roxygen2md} package will be used to -convert many Rd expressions to markdown. The package uses heuristics, so -you'll need to check the results. +If you are already using roxygen2, but not with markdown, you'll need to use +\href{https://roxygen2md.r-lib.org}{roxygen2md} to convert existing Rd +expressions to markdown. The conversion is not perfect, so make sure +to check the results. }