Skip to content

Commit

Permalink
Use knit2html(template = FALSE) instead of `knit2html(fragment.only…
Browse files Browse the repository at this point in the history
… = TRUE)` (#211)
  • Loading branch information
schloerke committed May 9, 2023
1 parent 4f308ae commit 6a32dfe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion 020-knit-html/Readme.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
This example shows you how to knit an R Markdown document using the two packages **knitr** and **markdown**, and include the HTML output in a shiny app. Note we are using [R Markdown v1](http://rmarkdown.rstudio.com/authoring_migrating_from_v1.html) here, which has a couple of differences with [v2](http://rmarkdown.rstudio.com). The basic idea is to call `knitr::knit2html()` with the argument `fragment.only = TRUE` to generate a fragment of HTML code.
This example shows you how to knit an R Markdown document using the two packages **knitr** and **markdown**, and include the HTML output in a shiny app. Note we are using [R Markdown v1](http://rmarkdown.rstudio.com/authoring_migrating_from_v1.html) here, which has a couple of differences with [v2](http://rmarkdown.rstudio.com). The basic idea is to call `knitr::knit2html()` with the argument `template = FALSE` to generate a fragment of HTML code.
2 changes: 1 addition & 1 deletion 020-knit-html/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function(input, output) {
knitr::opts_knit$set(root.dir = owd)

tagList(
HTML(knitr::knit2html(text = readLines(src), fragment.only = TRUE)),
HTML(knitr::knit2html(text = readLines(src), template = FALSE)),
# typeset LaTeX math
tags$script(HTML('MathJax.Hub.Queue(["Typeset", MathJax.Hub]);')),
# syntax highlighting
Expand Down
2 changes: 1 addition & 1 deletion 107-events/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fluidPage(
),

mainPanel(
HTML(knit2html(fragment.only = TRUE, text = md)),
HTML(knit2html(template = FALSE, text = md)),
plotOutput('distPlot'),
verbatimTextOutput('slider_info1'),
tags$h3("slider_info2"),
Expand Down

0 comments on commit 6a32dfe

Please sign in to comment.