What I am trying to do is parse at HTML string returned from a reactive function from server.R. I have tried for several days to solve this but no luck. For instance, given the following ui.R file:
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Code"),
sidebarPanel(
),
mainPanel(
textOutput("code")
)
))
and server.R file:
shinyServer(function(input, output) {
output$code <- renderText({
HTML('<strong> Hello World <strong>')
})
})
I would like the output to be:
Hello World
Instead of the raw HTML text output showing the strong tag.
Essentially, I would like to have the HTML text parsed in the ui.R. I am actually trying to do something more complex than this, but once I get this simple problem solved, I should be OK. I can't just put the HTML tag within the ui.R, because I would like it to change based on some other values. Thank you!
All, I have found the solution thanks to kind soul over at StackOverflow. You just use renderUI and uiOutput as such:
server.R
shinyServer(function(input, output) {
output$code <- renderUI({
HTML('<strong> Hello World <strong>')
})
})
ui.R
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Code"),
sidebarPanel(
),
mainPanel(
uiOutput("code")
)
))
Question solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With