7

I have an app running on shiny server and I would like to format smalls parts of text without needing to manage the css/html for the entirety of the page.

Simple example:

In the ui.r, I have some lines of help text that I would like to stylize.

sidebarPanel(
 ...
 , helpText("<I>Can</I> <em>this</em> <strong>happen</strong>?")
 )

Which gives:

# Current Output: 
<I>Can</I> <em>this</em> <strong>happen</strong>?

#desired Output:
Can this happen?

The text is (understandably) rendered as a literal string.
Is there a function or command to force the HTML to be parsed?

Ricardo Saporta
  • 54,400
  • 17
  • 144
  • 178

1 Answers1

10

Use this:

sidebarPanel(
 ...
 , HTML("<I>Can</I> <em>this</em> <strong>happen</strong>?")
 )

As an aside, you can even use renderText on the server side to build a full HTML output string, which can change, depending on your inputs. I often use this to post automated commentary (e.g. "The latest data release is y.... this is an increase of y, relative to the previous release...").

PMaier
  • 592
  • 7
  • 19
  • 2
    In regards to the aside, if I use `renderText` in the server to build an html string, like `my reactive headingmy reactive text` then how do I output that on the UI side? I tried `HTML(textOutput("theOutput"))` and that didn't work. Thanks! – seth127 Jan 02 '16 at 15:21