inst/doc/bookdown.R

## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ---- results='asis', echo = FALSE, eval = FALSE------------------------------
#  # run this to update the content below
#  xfun::pkg_attach2("xml2")
#  html <- read_html("https://bookdown.org/yihui/bookdown/")
#  chapters <- xml_find_all(html, "//li[@class='chapter']")
#  first_level <- chapters[which(purrr::map_lgl(xml_attr(chapters, 'data-level'), ~ grepl('^\\d+$', .x)))]
#  titles <- xml_text(xml_find_all(first_level, "a"))
#  titles <- gsub("^(\\d+)", "\\1.", titles)
#  titles <- gsub("^(.*) \\([*])$", "\\1", titles)
#  url <- file.path("https://bookdown.org/yihui/bookdown", xml_attr(first_level, "data-path"))
#  formatted <- sprintf("* [%s](%s)", titles, url)
#  cat(formatted, sep = "\n")

Try the bookdown package in your browser

Any scripts or data that you put into this service are public.

bookdown documentation built on Sept. 5, 2021, 5:19 p.m.