get_divs | R Documentation |
Get paired div blocks
get_divs(body, type = NULL, include = FALSE)
body |
an xml document |
type |
the type of div to return |
The strategy behind this is to :
find all dtag
elements, which will necessarily be <html_block> elements
containing div tags
grab the first tag of each pair
filter on div tag class (type)
grab all elements between the tags
a list of nodesets
Other div:
clean_div_tags()
,
find_between_tags()
,
find_div_pairs()
,
label_div_tags()
,
label_pairs()
,
make_div()
,
make_div_pairs()
,
replace_with_div()
loop <- Episode$new(file.path(lesson_fragment(), "_episodes", "14-looping-data-sets.md"))
loop$body # a full document with block quotes and code blocks, etc
loop$unblock() # removing blockquotes and replacing with div tags
pegboard:::get_divs(loop$body, 'challenge') # all challenge blocks
pegboard:::get_divs(loop$body, 'solution') # all solution blocks
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.