2017-04-04 7 views
3

タイトルごとに。説明するために:MarkdownはFluinyのfluidPage列の幅を分割します

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) 
) 

これは、それがどのように見えるべきかです::

enter image description here

はテキストをレンダリングすることを比較

enter image description here

これはバグですか?

答えて

3

あなたはmarkdownToHTML()への呼び出しでオプションfragment.only = TRUEが必要になります。これを追加した後

output$markdown <- renderUI({ 
     HTML(markdown::markdownToHTML(text = md, 
            fragment.only = TRUE)) 
    }) 

、アプリは正確にあなたの第二の例のようになります。

enter image description here

+1

どうもありがとうございましたヨリス – geotheory

関連する問題