clean_fenced_divs | R Documentation |
Sometimes pandoc fenced divs are bunched together, which makes it difficult to track the pairs. This separates them into different paragraph elements so that we can track them
clean_fenced_divs(body)
body |
an xml document |
an xml document
DEPRECATED.
txt <- "::::::: challenge
## Challenge
do that challenging thing.
```{r}
cat('it might be challenging to do this')
```
::::: solution ::::
```{r}
It's not that challenging
```
::::
::: solution ::::::::
We just have to try harder and use `<div>` tags
```{r}
cat('better faster stronger with <div>')
```
<img src='https://carpentries.org/logo.svg'/>
What if we include some `:::` code in here or ::: like this
:::::
:::::
::: good
## Good divs
:::"
f <- tempfile()
writeLines(txt, f)
ex <- tinkr::to_xml(f, sourcepos = TRUE)
ex$body
predicate <- ".//d1:paragraph/d1:text[starts-with(text(), ':::')]"
xml2::xml_text(xml2::xml_find_all(ex$body, predicate))
pegboard:::clean_fenced_divs(ex$body)
xml2::xml_text(xml2::xml_find_all(ex$body, predicate))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.