I want to display plain text in my Shiny app and I found the TextOutput and VerbatimTextOutput UI elements. From the documentation, I can see that they both escape HTML. According to the same documentation, they are often combined with different render functions, but that doesn't make the UI element different.
Where do they differ?
Apparently, the difference is in how they present the plain text.
VerbatimTextOutput
uses the HTML pre
tag. The pre
tag uses a fixed-width font (eg Courier) and does not modify line breaks and spaces. Therefore this is excellent to present formatted text such as code.
TextOutput
uses the div
tag. The div
tag does not necessarily use a fixed-width font (unless you use specific CSS). It also does not keep line breaks and multiple spaces in the same way that pre
does. This is more suited for prose.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.