Skip to content

Instantly share code, notes, and snippets.

@skranz
Created November 15, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skranz/6832705d691ca583a0ef to your computer and use it in GitHub Desktop.
Save skranz/6832705d691ca583a0ef to your computer and use it in GitHub Desktop.
Example <!–html_preserve–> problem in knit2html
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