https://github.com/cran/pkgdown
Raw File
Tip revision: 734352c469f19cb270b01aa86f91117117e69d29 authored by Hadley Wickham on 12 September 2020, 04:50:26 UTC
version 1.6.1
Tip revision: 734352c
build-home-md.R
build_home_md <- function(pkg) {

  mds <- dir_ls(pkg$src_path, glob = "*.md")

  # Also looks in .github, if it exists
  github_path <- path(pkg$src_path, ".github")
  if (dir_exists(github_path)) {
    mds <- c(mds, dir_ls(github_path, glob = "*.md"))
  }

  # Remove files handled elsewhere
  handled <- c("README.md", "LICENSE.md", "LICENCE.md", "NEWS.md", "cran-comments.md")
  mds <- mds[!path_file(mds) %in% handled]

  lapply(mds, render_md, pkg = pkg)
  invisible()
}

render_md <- function(pkg, filename) {
  body <- markdown(path = filename, strip_header = TRUE)

  cat_line("Reading ", src_path(path_rel(filename, pkg$src_path)))

  render_page(pkg, "title-body",
    data = list(pagetitle = attr(body, "title"), body = body),
    path = path_ext_set(basename(filename), "html")
  )
}
back to top