Description Usage Arguments Value Author(s) References Examples
View source: R/markdownInput.R
Create a markdown input control with a result preview
1 2 3 4 5 6 7 8 | markdownInput(
inputId,
label,
value = "Some **markdown** _text_",
theme = "github",
height = "400px",
class = ""
)
|
inputId |
The codeinput slot that will be used to access the value. |
label |
Label of the input. |
value |
The initial text to be contained in the editor. |
theme |
The Ace theme to be used by the editor. The theme in Ace
determines the styling and coloring of the editor.
Use |
height |
A number (which will be interpreted as a number of pixels) or any valid CSS dimension (such as "50%", "200px", or "auto"). |
class |
The CSS class name of the input. (optional) |
A tabset containing two tabs:
"Write" tab:
Containing a code editor (aceEditor
).
"Preview" tab: Containing the preview of the markdown render.
Julien Diot juliendiot42@gmail.com
shinyAce package: Vincent Nijs, Forest Fang, Trestle Technology, LLC and Jeff Allen (2019). shinyAce: Ace Editor Bindings for Shiny.
shiny package: Winston Chang, Joe Cheng, JJ Allaire, Yihui Xie and Jonathan McPherson (2018). shiny: Web Application Framework for R.
markdown package: JJ Allaire, Jeffrey Horner, Yihui Xie, Vicent Marti and Natacha Porte (2018). markdown: 'Markdown' Rendering for R.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ## 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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.