【问题标题】:Render package documentation into github wiki将包文档渲染到 github wiki
【发布时间】:2014-12-12 20:53:33
【问题描述】:

问题:
是否有任何技巧可以将包文档 Rd 文件呈现到 github wiki 页面中?
github wiki 页面支持的标记:https://github.com/github/markup#markups

背景:
html 镜像上有大量的 CRAN 包文档。这种用于 R 文档的 web 模板可以扩展为 github 托管的包。如果Rd 到wiki 是可能的,这将非常容易。许多,甚至是大部分 github 托管的包根本不使用 wiki。

【问题讨论】:

  • 这里有具体的编程问题吗?
  • 询问如何使用哪个特定功能将Rd 文件转换为github wiki 页面。我知道这是一个非常开放的问题。
  • 就目前而言,它可以作为题外话关闭(寻找工具)。我不知道这样的问题有什么好的中心。
  • 最近Rmd was allowed to be rendered as markdown。也许也可以在 Rd 那里尝试一个 FR(尽管它不完全相同)?
  • 好吧,不是 wiki 页面,但 gh-pages 可以使用 github.com/hadley/staticdocs

标签: r r-markdown devtools roxygen2


【解决方案1】:

tools 设计中有几个函数可以处理Rd 文件。

一种选择是将其转换为 html,然后使用 pandoc 转换为 markdown:

#' 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)
}

结果很漂亮,但可能会更糟。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-20
    • 2015-06-22
    • 1970-01-01
    相关资源
    最近更新 更多