Arguments
- x
A
pandocdocument, apandoc_blockswrapper, or a list of blocks.- level
Heading level at which to split (default
1). Headings at other levels stay inside their enclosing section.- ...
Unused; for future extension.
Value
A named list of pandoc documents. Names follow the heading
text, so two headings sharing a title yield repeated names; index by
position to keep such sections distinct.
Details
Partitions the top-level block stream of a pandoc document at every
heading of a given level, returning a named list of pandoc
documents (one per section, named by the heading text), the q2r analog
of mq's section::split(). Any blocks before the first boundary
heading become a leading preamble document named "".
Each returned document can be rendered with to_qmd(),
render_qmd(), or written out; wrap the list in a
qmd_collection if you want to run the batch verbs over it.