Skip to content

Instantly share code, notes, and snippets.

@jcheng5
Created November 10, 2012 23:33
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jcheng5/4052973 to your computer and use it in GitHub Desktop.
Save jcheng5/4052973 to your computer and use it in GitHub Desktop.
Adding raw HTML to Shiny apps
# Nothing to see here
shinyServer(function(input, output) {
})
<div>Here is a <strong>third</strong> way.</div>
shinyUI(bootstrapPage(
div(
div(
# You can use a string value as HTML by wrapping it with the HTML
# function. If you didn't do that, then the string would be treated as
# plain text and the HTML tags would be escaped. See ?HTML.
HTML("Here is <strong>one</strong> way to insert <em>arbitrary</em> HTML.")
),
div(
# Another way is to use the builder functions; see ?tags.
"Here is",
tags$span( # Creates an HTML span.
class="foo", # Any named args become attributes.
tags$strong("another"), # Unnamed args become children of the tag.
"way"
),
"to do it."
),
# The third way is to include a separate HTML file.
includeHTML("static.html")
)
))
@aykajaykumar
Copy link

If the html file is containing image, how to fit in some size.

@JohnCoene
Copy link

If the html file is containing image, how to fit in some size.

<img src="some/place/img.png" class="mg-responsive" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment