Created
April 8, 2016 00:47
-
-
Save nutterb/7d723f64201c9afa8bb57774b47bfd7c to your computer and use it in GitHub Desktop.
Shiny Real-time markdown rendering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(knitr) | |
library(markdown) | |
ui <- shinyUI( | |
fluidPage( | |
fluidRow( | |
column( | |
width = 6, | |
tags$textarea( | |
id = "text", | |
cols = 50, | |
rows = 30 | |
) | |
), | |
column( | |
width = 6, | |
uiOutput('markdown') | |
) | |
) | |
) | |
) | |
server <- function(input, output) { | |
output$markdown <- renderUI({ | |
HTML(markdown::markdownToHTML(text = input$text)) | |
}) | |
} | |
shinyApp(ui, server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy and paste the code below into the textArea input when the application is running. | |
# Header 1 | |
## Header 2 | |
### Header 3 | |
#### Header 4 | |
##### Header 5 | |
It would be really helpful to include a link to a markdown cheat sheet. [This is a good example](http://support.mashery.com/docs/read/customizing_your_portal/Markdown_Cheat_Sheet) of where to get a good rundown of basic markdown. | |
> We can place block quotes this way | |
> It's quite lovely | |
``` | |
We can also block out code segments. | |
x <- rnorm(100) | |
hist(x) | |
``` | |
If we want to make a table | |
| Column 1 | Column 2 | | |
|----------------|---------------:| | |
| r1, c1 | r1, c2 | | |
| r2, c1 | r2, c2 | | |
| |
The makes a non breaking space that is useful for putting in white space. | |
We write _italic_ text this way. | |
And we can make **bold** text this way | |
Lists are simple | |
* Item | |
* Item | |
* Item | |
Ordered lists are easy too | |
1. Item 1 | |
2. Item 2 | |
3. Item 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment