2.4 Alternative way to write tags
Raw HTML can be included via the
htmltools::HTML()
function. It prevents HTML content not being properly recognized:<div>Hello <i>world</i></div>
<div>Hello <i>world</i></div>
When creating HTML elements for a Shiny app, it’s recommended to do so via R, instead of mixing it with raw HTML:
<div>lorem</div>
<div>lorem</div>
[1] "html" "character"
[1] "shiny.tag"
The
shiny.tag
class is required for some tag-related functions which we’ll cover in the next sections.