Removing whitespace in Shiny font tags

In the UI of my app, I have something like

p("blah blah blah (", em("e.g.,"), ") blah blah blah")

However this produces output with a space between the opening parenthesis and the italicized letter 'e', which is not what is needed.

I've searched Google for a solution (as it seems quite a simple fix), but have come up empty-handed.

A more general peeve of Shiny is the inclusion of a large black of whitespace within a tabPanel(..., h3("...")), which is also unintended.

Does anyone have a solution that avoids whitespace in this regard?

Maybe you could try the .noWS argument of those tags:

library(shiny)

ui <- fluidPage(
  p("blah blah blah (", em("e.g.,", .noWS = c('before')), ") blah blah blah"), # and some other options available for .noWS, see the doc
  p("blah blah blah (", em("e.g.,"), ") blah blah blah")
)

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

shinyApp(ui, server)

Thanks! This worked.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.