inst/doc/rmarkdown.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/rmarkdown-cookbook/")
#  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/rmarkdown-cookbook", xml_attr(first_level, "data-path"))
#  formatted <- sprintf("* [%s](%s)", titles, url)
#  cat(formatted, sep = "\n")

Try the rmarkdown package in your browser

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

rmarkdown documentation built on Nov. 4, 2024, 5:06 p.m.