Skip to content
Open
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
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The following Rd code is converted to the Markdown equivalent:
If necessary, `DESCRIPTION` is edited to enable Markdown in roxygen blocks.
You'll need `roxygen2` version 6.0.0 or later.

Call `roxygen2md::roxygen2md()` in your package's directory, or navigate to "Tools/Addins/Rd to Markdown" in RStudio.
Call [`roxygen2md::roxygen2md()`](https://roxygen2md.r-lib.org/reference/roxygen2md.html) in your package's directory, or navigate to "Tools/Addins/Rd to Markdown" in RStudio.

The substitutions are not completely safe, please carefully examine the results!

Expand Down Expand Up @@ -57,7 +57,7 @@ If you are using RStudio, choose the item "Rd to Markdown" from your "Addins" me

You will be guided through the process.

At any time, choose the item "Find Rd" from your "Addins" menu, or run `find_rd()`, to enumerate Rd elements in your R scripts.
At any time, choose the item "Find Rd" from your "Addins" menu, or run [`find_rd()`](https://roxygen2md.r-lib.org/reference/find_rd.html), to enumerate Rd elements in your R scripts.

## Converting large packages

Expand All @@ -70,46 +70,46 @@ using `roxygen2md(scope = "none")`, `"simple"` and `"full"` in sequence:
- `"unlink"` splits complicated `\code{}` tags with embedded `\link{}`

This helps isolating mostly automated changes from changes that require review.
After this `find_rd()` shows remaining Rd format artifacts that were not handled by the conversion.
After this [`find_rd()`](https://roxygen2md.r-lib.org/reference/find_rd.html) shows remaining Rd format artifacts that were not handled by the conversion.

See <https://github.com/rstudio/rmarkdown/pull/1583> for an example conversion.

### Baseline

After `roxygen2md(scope = "none")`, interpretation of Markdown elements is enabled.
Running `devtools::document()` should ideally lead to whitespace-only changes in the `.Rd` files,
Running [`devtools::document()`](https://devtools.r-lib.org/reference/document.html) should ideally lead to whitespace-only changes in the `.Rd` files,
this can be verified with `git diff -w -- man` or with a visual diff tool like Meld or diffuse.
Make sure that enabling of Markdown doesn't add unwanted artifacts.
(The second commit in the example PR was necessary due to such artifacts -- the underscore has a special meaning in Markdown.)

### Simple conversion

Running `roxygen2md(scope = "simple")` after `"none"` (and running `devtools::document()`) should lead to changes in R files mostly,
Running `roxygen2md(scope = "simple")` after `"none"` (and running [`devtools::document()`](https://devtools.r-lib.org/reference/document.html)) should lead to changes in R files mostly,
only very few `.Rd` files should be changed.
Again, make sure this doesn't add unwanted artifacts.

### Removing links

Optionally, run `roxygen2md(scope = "unlink")` after `"simple"` (and running `devtools::document()`).
Optionally, run `roxygen2md(scope = "unlink")` after `"simple"` (and running [`devtools::document()`](https://devtools.r-lib.org/reference/document.html)).
This replaces all instances of `\link{...}` with `...`.
This isn't a valid conversion,
but a helper to split up complex instances of `\code{...\link{...}...}` for which no easy-to-read translation to Markdown exists.
Use a visual diff tool like Meld or diffuse to quickly iterate through all changes and keep only those that are intended.
Run `devtools::document()` and commit if necessary.
Run [`devtools::document()`](https://devtools.r-lib.org/reference/document.html) and commit if necessary.

Consider inserting `@seealso` tags to link to functions instead.
Render the documentation with [pkgdown](https://pkgdown.r-lib.org/) to take advantage of its [auto-link feature](https://pkgdown.r-lib.org/articles/linking.html) -- all functions gain automatic links without the need for further markup.

### Full conversion

Running `roxygen2md()` after `scope = "simple"` (and running `devtools::document()`) converts all `\link{}` expressions.
Running [`roxygen2md()`](https://roxygen2md.r-lib.org/reference/roxygen2md.html) after `scope = "simple"` (and running [`devtools::document()`](https://devtools.r-lib.org/reference/document.html)) converts all `\link{}` expressions.
This is the trickiest part of the entire conversion.
Due to the staged approach, the changeset is reduced to a minimum.
Review carefully, luckily `R CMD check` catches bad links introduced in this stage.

### Manual conversion

The `find_rd()` functions shows positions of Rd-like comments that were not handled by the conversion.
The [`find_rd()`](https://roxygen2md.r-lib.org/reference/find_rd.html) functions shows positions of Rd-like comments that were not handled by the conversion.
In RStudio, a markers pane will open.

## Limitations
Expand Down