按照标题。举例说明:
md = "# Lorem ipsum
1. dolor sit amet, amet ut integer vitae, justo pretium sed praesent, velit vitae proin molestie metus nec. A mi id quisque libero, in sed urna non etiam iaculis id, purus cum sit et. Maecenas purus sit rhoncus fringilla velit, etiam et justo risus pharetra, leo convallis ut platea, turpis tellus urna sed, leo scelerisque velit nam urna. Felis tincidunt fringilla, suspendisse molestie dui, phasellus aliquam nec adipiscing enim fusce metus, vulputate dictumst etiam est a. Rhoncus ut, netus aenean rutrum vehicula ipsum, maecenas nec ut mauris."
shinyApp(
fluidPage(
fluidRow(
column(3,
selectInput('countries', 'countries', state.name, "country")
),
column(9,
plotOutput('plot'),
uiOutput('markdown')
)
)
),
function(input, output, session) {
output$plot <- renderPlot({
plot(rnorm(100))
})
output$markdown <- renderUI({
HTML(markdown::markdownToHTML(text = md))
})
},
options = list(launch.browser=T)
)
产生:
将其与渲染文本进行比较:
shinyApp(
fluidPage(
fluidRow(
column(3,
selectInput('countries', 'countries', state.name, "country")
),
column(9,
plotOutput('plot'),
textOutput('txt')
)
)
),
function(input, output, session) {
output$plot <- renderPlot({
plot(rnorm(100))
})
output$txt <- renderText(md)
},
options = list(launch.browser=T)
)
这应该是它的样子:
这是一个错误吗?