3
votes

Question:
Are there any tricks which would render package documentation Rd files into github wiki pages?
github wiki pages supported markups: https://github.com/github/markup#markups

Background:
There are tons of CRAN packages doc on html mirrors. This kind of web-template for R documentation could be extended for github hosted packages. If Rd to wiki would be possible this would be very easy. Many, maybe even most of, github hosted packages do not use wiki at all.

1
Is there a specific programming question in here? - Roman Luštrik
Question how one could use which particular function to transform Rd file into github wiki page. I understand it is quite an open question. - jangorecki
As it stands, it could be closed as off-topic (looking for a tool). I don't know what a good hub would be for such questions. - Roman Luštrik
Recently Rmd was allowed to be rendered as markdown. Maybe try an FR there for Rd as well (although it's not exactly the same)? - Arun
Well, not for wiki pages, but gh-pages could use github.com/hadley/staticdocs - daroczig

1 Answers

2
votes

There is a couple of functions in tools design to work with Rd files.

One option would be to convert it to html and then to markdown using pandoc:

#' Convert rd file to markdown
#' @param rd path to rd file
rd_to_markdown <- function(rd) {
    html <-  paste(rd, ".html", sep = "")
    tools::Rd2HTML(tools::parse_Rd(rd), out = html)
    system( paste("pandoc -s -r html ", html, " -o ", rd, ".text", sep=""))
    unlink(html)
}

Result is far form pretty but it could be worse.