I have a problem with text in Shiny Dashboard. I would like to save original text formatting, but shiny removes the whitespaces I want to keep.
output$frame <
I found that we can also use stri_dup(intToUtf8(160), 6)
from package stringi
.
You can use HTML(' ')
to add 1 whitespace and HTML(' ')
to add 1 tab space. In your code it wold be as follows:
output$frame <- renderUI({
HTML(paste(
p(strong("Name and Surname:"), HTML(' '),HTML(' '),"John Smith")
)
)
})
With this you get two white spaces and output looks like this:
I found this oddly difficult to achieve. Just adding the style element to pre-wrap introduced an extra new line:
p(strong("Name and Surname:"),(" John Smith"),style="white-space: pre-wrap")
No other style elements (margin:0, etc) could fix this...so,to get around it, I just converted your strong() to HTML, and it works great:
p(HTML("<b>Name and Surname:</b> John Smith"),style="white-space: pre-wrap")