Skip to content

Commit

Permalink
Polish roxygen2 markdown experience
Browse files Browse the repository at this point in the history
* Turn on by default
* Refine use_roxygen_md() to just suggest using roxygen2md

Fixes #911
  • Loading branch information
hadley committed Oct 16, 2019
1 parent b4594e4 commit a905dd9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
3 changes: 2 additions & 1 deletion R/description.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
)
)
}
Expand Down
17 changes: 7 additions & 10 deletions R/roxygen.R
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -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.")
}
Expand Down
9 changes: 4 additions & 5 deletions man/use_roxygen_md.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a905dd9

Please # to comment.