View source: R/rmd_fenced_div_wrap.R
rmd_fenced_div_wrap | R Documentation |
This function wraps selected nodes in an rmd_ast
with fenced div
opening and closing tags. The selection is implemented using the same approach
as rmd_select()
which enables a variety of useful syntax for selecting nodes.
The function checks if the selected indices form a single continuous range. If this
is not the case then an error will be thrown. If wrapping multiple discontinous ranges
of nodes is desired then the allow_multiple
can be set to TRUE
.
rmd_fenced_div_wrap(
x,
...,
open = rmd_fenced_div_open(),
allow_multiple = FALSE
)
x |
Rmd object, e.g. |
... |
One or more unquoted expressions separated by commas for node selection.
Uses the same syntax as |
open |
An |
allow_multiple |
Logical. If |
Returns the modified Rmd object with selected nodes wrapped in the fenced div(s).
rmd = parse_rmd(system.file("examples/hw01.Rmd", package = "parsermd"))
rmd_fenced_div_wrap(rmd, "plot-dino":"cor-dino")
rmd_fenced_div_wrap(rmd, has_type("rmd_chunk"), allow_multiple=TRUE)
rmd_fenced_div_wrap(
rmd, has_type("rmd_chunk"),
open = rmd_fenced_div_open(classes = ".note"),
allow_multiple = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.