Skip to contents

These functions are used to programmatically alter the Rmd, once it has been split (see splitting).

In morph_doc(), global changes can be defined. Then, the user must supply one s* = morph_sec(...) arguments, where * corresponds to the section number, for each section he wants to keep.

In morph_sec(), local section changes can be defined. Then, the user must supply one b* = fun(...) to each block he wants to keep. There is also the possibility to add new lines of markdown with unnamed calls. See the available block editing functions in editing.

Usage

morph_doc(sections, ..., head_lv = 2, end = "pbr")

morph_sec(..., head_lv = NULL, end = NULL)

Arguments

sections

A list of sections as returned by split_sections.

...

s* = morph_sec(...) arguments for morph_doc(), or b* = fun(...) arguments for morph_sec().

head_lv

An integer value to set the heading level of the current section header. The default value for morph_sec is whatever was passed to the morph_doc()'s argument. Can be overridden by passing a head1 argument.

end

To set the default value for e()'s' and div()'s end argument. The default value for morph_sec is whatever was passed to the morph_doc()'s argument.

Value

For morph_doc(), a character vector containing the morphed document. morph_sec() should not be used outside morph_doc().