Skip to content

Change the order of fragments #30

@etiennebacher

Description

@etiennebacher

Hello, thank you for this package!

Is there a way to customize the order of the fragments in the output? In the example below, I'd like to put the description between the title and the usage:

  tmp <- tempfile(fileext = ".Rd")
  cat("
  % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/source.R
\\name{Foo}
\\title{Foo}
\\usage{
foo()
}
\\value{
Some value
}
\\description{
Some description
}
\\examples{
# some example
}
  ", file = tmp)
  
  cat(rd2markdown::rd2markdown(file = tmp))
#> 
#> 
#> # Foo
#> 
#> ```r
#> foo()
#> ```
#> 
#> ## Returns
#> 
#> Some value
#> 
#> Some description
#> 
#> ## Examples
#> 
#> ```r
#> # some example
#> ```

Using the argument fragments doesn't change anything:

  tmp <- tempfile(fileext = ".Rd")
  cat("
  % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/source.R
\\name{Foo}
\\title{Foo}
\\usage{
foo()
}
\\value{
Some value
}
\\description{
Some description
}
\\examples{
# some example
}
  ", file = tmp)
  
  cat(rd2markdown::rd2markdown(file = tmp, fragments = c("title", "description", "usage", "value", "examples")))
#> # Foo
#> 
#> ```r
#> foo()
#> ```
#> 
#> ## Returns
#> 
#> Some value
#> 
#> Some description
#> 
#> ## Examples
#> 
#> ```r
#> # some example
#> ```

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions