3

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.

10
  • Is there a specific programming question in here? Commented Dec 12, 2014 at 20:59
  • Question how one could use which particular function to transform Rd file into github wiki page. I understand it is quite an open question. Commented Dec 12, 2014 at 21:01
  • 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. Commented Dec 12, 2014 at 21:07
  • 1
    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)? Commented Dec 12, 2014 at 21:41
  • 1
    Well, not for wiki pages, but gh-pages could use github.com/hadley/staticdocs Commented Dec 12, 2014 at 23:30

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.