如何在Shiny App helpText()中包含代码块

时间:2017-04-12 04:15:27

标签: html r shiny

我有以下 ui.R

library(datasets)

# Use a fluid Bootstrap layout
fluidPage(    

  # Give the page a title
  titlePanel("Telephones by region"),

  # Generate a row with a sidebar
  sidebarLayout(      

    # Define the sidebar with one input
    sidebarPanel(
      selectInput("region", "Region:", 
                  choices=colnames(WorldPhones)),
      hr(),
      helpText("Some text and then some code.")
    ),

    # Create a spot for the barplot
    mainPanel(
      plotOutput("phonePlot")  
    )

  )
)

helpText()产生的地方:

<span class="help-block">
 Some text and then some code.
</span>

如何修改helpText以便包含代码块:

<span class="help-block">
 Some text and then <code>some code</code>.
</span>

1 个答案:

答案 0 :(得分:3)

使用

helpText("Some text and then ", code("some code"), ".")