View source: R/utils-aggregate.R
get_content | R Documentation |
Get sections from an episode's HTML page
get_content(
episode,
content = "*",
label = FALSE,
pkg = NULL,
instructor = FALSE
)
episode |
an object of class |
content |
an XPath fragment. defaults to "*" |
label |
if |
pkg |
an object created via |
instructor |
if |
The contents of the lesson are contained in the following templating cascade:
<body> <div class='container'> <div class='row'> <div class='[...] primary-content'> <main> <div class='[...] lesson-content'> CONTENT HERE
This function will extract the content from the episode without the templating.
if (FALSE) {
lsn <- "/path/to/lesson"
pkg <- pkgdown::as_pkgdown(fs::path(lsn, "site"))
# for AiO pages, this will return only the top-level sections:
get_content("aio", content = "section", label = TRUE, pkg = pkg)
# for episode pages, this will return everything that's not template
get_content("01-introduction", pkg = pkg)
# for things that are within lessons but we don't know their exact location,
# we can prefix a `/` to double up the slash, which will produce
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.