R/rstudio_addin_beautify_table.R

Defines functions beautifytableaddin

Documented in beautifytableaddin

#' Beatuify Table Addin
#'
#' Addin for beautifyR. It collects the selected markdown table and hands it off
#' to the `beautifyR` function.
#'
#' @import rstudioapi
#' @keywords internal

beautifytableaddin <- function(){
  con <- rstudioapi::getActiveDocumentContext()

  # Get selection text
  con_text <- con$selection[[1]]$text

  # beautify and return the selection
  rstudioapi::insertText(beautifyR(con_text))
}
mwip/beautifyR documentation built on Oct. 23, 2022, 8:21 a.m.