Learn R Programming

markdownInput (version 0.1.2)

moduleMarkdownInput: Server function of the markdownInput module

Description

Server function of the markdownInput module

Usage

moduleMarkdownInput(input, output, session, class = "")

Arguments

input

The session's input object.

output

The session's output object.

session

The shiny's session.

class

(optional) The CSS class name of the priview tab.

Value

The reactive value of the input.

References

  1. shinyAce package: Vincent Nijs, Forest Fang, Trestle Technology, LLC and Jeff Allen (2019). shinyAce: Ace Editor Bindings for Shiny.

  2. shiny package: Winston Chang, Joe Cheng, JJ Allaire, Yihui Xie and Jonathan McPherson (2018). shiny: Web Application Framework for R.

  3. markdown package: JJ Allaire, Jeffrey Horner, Yihui Xie, Vicent Marti and Natacha Porte (2018). markdown: 'Markdown' Rendering for R.

Examples

Run this code
# NOT RUN {
## Only run examples in interactive R sessions
if (interactive()) {
 library(shiny)
 library(markdownInput)
 ui <- fluidPage(titlePanel("Markdown input"),
                 sidebarLayout(
                   # inputs:
                   sidebarPanel(
                     markdownInput(
                       "mdInputID",
                       label = "Write your text",
                       value = "Write some _markdown_ **here:**"
                       )
                   ),

                   # outputs:
                   mainPanel(
                   h3("Raw value of the input:"),
                   verbatimTextOutput("rawResult"))
                 ))

 server <- function(input, output, session) {
   # myText is a reactive variable containing the raw markdown text
   myText <- callModule(moduleMarkdownInput, "mdInputID")

   # show "myText"
   output$rawResult <- renderPrint({
     print(myText())
   })

 }

 shinyApp(ui, server)

}
# }

Run the code above in your browser using DataLab