最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - Avoid line break in the output of R shiny code - Stack Overflow

programmeradmin5浏览0评论

In my Code tags$p(HTML("...") is shown in one line in the browser output.

And my question is: How can I achieve a browser output with the two lines tags$strong("strong text") and p(" created with <strong>...</strong>") compared to tags$p(HTML("...")? Any hint how to avoid a line break?

ui <- fluidPage(        
    
    
    # HTML spelling and the output appears in one line       
    tags$p(HTML("
            <strong>strong text</strong> created with the tag &lt;strong&gt;...&lt;/strong&gt;)
    ")),

    # The following two lines of code should appear in the same line in my browser
    tags$strong("strong text"),
    p(" created with <strong>...</strong>")

)

server <- function(input, output, session) {
}

shinyApp(ui, server)

In my Code tags$p(HTML("...") is shown in one line in the browser output.

And my question is: How can I achieve a browser output with the two lines tags$strong("strong text") and p(" created with <strong>...</strong>") compared to tags$p(HTML("...")? Any hint how to avoid a line break?

ui <- fluidPage(        
    
    
    # HTML spelling and the output appears in one line       
    tags$p(HTML("
            <strong>strong text</strong> created with the tag &lt;strong&gt;...&lt;/strong&gt;)
    ")),

    # The following two lines of code should appear in the same line in my browser
    tags$strong("strong text"),
    p(" created with <strong>...</strong>")

)

server <- function(input, output, session) {
}

shinyApp(ui, server)
Share Improve this question asked 2 hours ago tueftlatueftla 4351 gold badge4 silver badges20 bronze badges 3
  • I'm bit confused, <p> is the paragraph element, i.e. your are explicitly stating that it's content should be in a separate block, not on the same line. So ... don't use p()? fluidPage(strong("foo"), "bar") – margusl Commented 1 hour ago
  • @margusl Thanks for your hint but I'm relative new to this topic so sometimes obvious is not obviously to me... – tueftla Commented 1 hour ago
  • That's fine. There's Shiny HTML Tags Glossary for those without HTML background. /../ But what if you are unfamiliar with HTML tags? The glossary below explains what the most popular tags in tags do. /../ – margusl Commented 8 mins ago
Add a comment  | 

1 Answer 1

Reset to default 1

Not sure, but maybe you are looking for this (child tags):

library(shiny)

ui <- fluidPage(
  # HTML spelling and the output appears in one line
  tags$p(HTML("<strong>strong text</strong> created with the tag &lt;strong&gt;...&lt;/strong&gt;)")),
  # The following two lines of code should appear in the same line in my browser
  p(tags$strong("strong text"), " created with tags$strong('...')")
  )

server <- function(input, output, session) {}

shinyApp(ui, server)
发布评论

评论列表(0)

  1. 暂无评论