label_div_tags | R Documentation |
Add labels to div tags in the form of a "dtag" node with a paired "label" attribute.
label_div_tags(body)
find_div_tags(body)
clear_div_labels(body)
body |
an xml document |
label_div_tags()
: the document, modified
clear_div_labels()
: the document, modified
find_div_tags()
: a node list
Other div:
clean_div_tags()
,
find_between_tags()
,
find_div_pairs()
,
get_divs()
,
label_pairs()
,
make_div()
,
make_div_pairs()
,
replace_with_div()
txt <- "# Example with a mix of div tags
> PLEASE NEVER DO THE LESSONS THIS WAY
>
> I AM LITERALLY JUST TESTING A TERRIBLE EXAMPLE.
--------------------------------------------------------------------------------
<div class='challenge'>
## Challenge
do that challenging thing.
```{r}
cat('it might be challenging to do this')
```
:::: solution
```{r}
It's not that challenging
```
:::
<div class='solution'>
We just have to try harder and use `<div>` tags
:::::: callout
```{r}
cat('better faster stronger with <div>')
```
::::
:::::: discussion
<img src='https://carpentries.org/logo.svg'/>
:::::
</div>
</div>
<div class='good'>
## Good divs
</div>
"
tmp <- tempfile()
writeLines(txt, tmp)
ex <- tinkr::to_xml(tmp)
ex$body
pegboard:::label_div_tags(ex$body)
ex$body
pegboard:::clear_div_labels(ex$body)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.