Created
November 15, 2015 08:49
-
-
Save skranz/6832705d691ca583a0ef to your computer and use it in GitHub Desktop.
Example <!–html_preserve–> problem in knit2html
This file contains hidden or 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(htmlwidgets) | |
library(knitr) | |
md.code = ' | |
There are the annoying <!–html_preserve–> lines... | |
```{r "mychunk"} | |
textInput("myInput","Enter text","Hello World") | |
``` | |
Setting results="asis" does not help... | |
```{r "mychunk2", results="asis"} | |
textInput("myInput2","Enter text","Hello World") | |
``` | |
' | |
ui = shinyUI(fluidPage( | |
uiOutput("knitr") | |
)) | |
server = shinyServer(function(input, output, session) { | |
output$knitr = renderUI({ | |
html = knitr::knit2html(text=md.code,fragment.only = TRUE) | |
HTML(html) | |
}) | |
}) | |
runApp(list(ui=ui, server=server)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment