Skip to contents

RStudio add-in to insert selected lines into code block:

  • qmd_code_block() - verbatim code block.

  • qmd_code_block_r() - R code block. Note! In Visual Editor (VE) mode works differently: in VE mode, RStudio IDE command insertChunk is executed, which currently means that non-selected text will not be included in the chunk automatically. If the chunk is included as the last line of the document in VE mode, the selected text is interpreted as chunk options, otherwise as chunk contents.

qmd_code_block_r_split() - splits block of R code.

These functions internally use function addin.tools::rs_enclose_selected_rows_with() - that adds lines above and below the selection.

Usage

qmd_code_block_r(context = rs_get_context())

qmd_code_block_python(context = rs_get_context())

qmd_code_block_sql(context = rs_get_context())

qmd_code_block(context = rs_get_context())

qmd_code_block_r_split(context = rs_get_context())

Arguments

context

(class document_context)
Object with context of active RStudio document.

See also

Other Quarto formatting add-ins: format_md, qmd_equations, qmd_list()