rmd_code_block: Convert rows into the block of code.

View source: R/rmd_code_block.R

rmd_code_blockR Documentation

Convert rows into the block of code.

Description

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

  • rmd_code_block() - verbatim code block. Note: in Markdown Visual Editor mode does not work.

  • rmd_code_block_r() - R code block. Note! In Markdown Visual Editor (MVE) mode works differently: in MVE 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 MVE mode, the selected text is interpreted as chunk options, otherwise as chunk contents.

rmd_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

rmd_code_block_r(context = rs_get_context())

rmd_code_block_python(context = rs_get_context())

rmd_code_block_sql(context = rs_get_context())

rmd_code_block(context = rs_get_context())

rmd_code_block_r_split(context = rs_get_context())

Arguments

context

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

See Also

Other R Markdown formatting add-ins: format_rmd, rmd_equations, rmd_list()


GegznaV/addins.rmd documentation built on Aug. 25, 2023, 4:43 p.m.