output[["code"]] <- kit_render_code_panel(function() code_text()).
Nothing is computed while the panel is collapsed (Shiny does not render hidden outputs; it
computes only when "用 R 怎麼做" ("How to do it in R") is opened). When code() stops
(req()), fails, or is empty, only the empty line is shown.
Usage
kit_render_code_panel(
code,
note = KIT_CODE_NOTE,
width = KIT_CODE_WIDTH,
empty = KIT_CODE_EMPTY
)Arguments
- code
A function or reactive that returns the code: the
snipsofkit_code_blocks().- note, width
See
kit_code_blocks().- empty
The one line shown while there is no code yet.
Examples
if (interactive()) {
server <- function(input, output, session) {
output$code <- kit_render_code_panel(function() "x <- 1")
}
}